1 Star 0 Fork 0

pangyinqiang/testGit4

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
12 3.57 KB
一键复制 编辑 原始数据 按行查看 历史
pangyinqiang 提交于 2024-10-29 17:02 +08:00 . add 12.
import * as React from 'react';
import { useState, useRef, useEffect } from 'react';
import {
Text,
StyleSheet,
View,
ScrollView,
UIManager,
findNodeHandle,
requireNativeComponent,
DeviceEventEmitter,
Platform,
Button,
SafeAreaView
} from 'react-native';
import MarqueeView from '../basic/MarqueeView';
import ButtonView from '../basic/ButtonView';
import SampleTurboModule from '../basic/SampleTurboModule';
import SampleTurboModule2, {
Fruit,
ResultModel,
} from '../basic/SampleTurboModule2';
import GoodsButton from './GoodsButton';
import { Dimensions } from "react-native";
import Pdf from "react-native-pdf";
import PagerView from 'react-native-pager-view';
const isCAPI =
'rnohArchitecture' in Platform.constants &&
Platform.constants.rnohArchitecture === 'C_API';
function AppGoods() {
const [nativeCallbackValue, setNativeCallbackValue] = useState("");
const [nativeAsyncCallbackValue, setNativeAsyncCallbackValue] = useState("");
const [marqueeStop, setMarqueeStop] = useState(false);
const [nativeEmitterParam, setNativeEmitterParam] = useState("");
const [nativeButtonEmitterParam, setNativeButtonEmitterParam] = useState("");
const [buttonClick, setButtonClick] = useState(false);
const nativeRef = useRef<any>(null);
const nativeRefButton = useRef<any>(null);
const [showButton, setShowButton] = useState("false");
let source = { uri: 'https://autoservice-sit.pingan.com.cn/default/web/capp/static/images/privacyPolicy.pdf?timestamp=1725353597690' }
useEffect(() => {
console.log(`useEffect PDF 加载完成`);
setShowButton('true')
}, []);
DeviceEventEmitter.addListener('clickMarqueeEvent', e => {
setNativeEmitterParam(JSON.stringify(e.params.age));
});
return (
<View style={styles.sectionContainer}>
<View>
{showButton == "true" && <Button title={`showButton is ${showButton}2`}></Button>}
</View>
<Pdf
source={source}
onLoadComplete={(numberOfPages) => {
// setShowButton('true')
console.log(`PDF 加载完成: ${numberOfPages} 页`);
}}
onPageChanged={(page, numberOfPages) => {
console.log(`页面改变: ${page} / ${numberOfPages}`);
}}
onError={(error) => {
console.log(error);
}}
style={styles.pdf}
/>
<View>
{showButton == "true" && <Button title={`buttonClick is ${showButton}2`}></Button>}
</View>
</View>
);
}
export default AppGoods;
const styles = StyleSheet.create({
pagerView: {
flex: 1,
},
//创建样式
container: {
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#E6E6E6',
},
textContainer: {
justifyContent: 'center',
backgroundColor: 'white',
width: '90%',
marginVertical: 10,
marginHorizontal: 50,
borderRadius: 10,
padding: 15,
},
titleTextFont: {
fontSize: 18,
textAlign: 'left',
},
constantsFont: {
width: '100%',
marginTop: 5,
padding: 10,
borderRadius: 5,
fontSize: 16,
textAlign: 'left',
alignSelf: 'flex-start',
color: '#31525B',
backgroundColor: 'white',
},
sectionContainer: {
flex: 1,
justifyContent: "space-between",
alignItems: "center",
backgroundColor: "red",
},
pdf: {
flex: 1,
width: 300, //Dimensions.get("window").width,
height: 300, //Dimensions.get("window").height-100,
},
});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/pang-yinqiang/test-git4.git
git@gitee.com:pang-yinqiang/test-git4.git
pang-yinqiang
test-git4
testGit4
master

搜索帮助