如果用android来写的话,应该怎么实现
我自己用得操作系统是ubuntu,我想要开发一个react native app,我想问在ubuntu系统分别用什么模拟器跑android和ios的打包文件。 或者react native基于linux有什么好的开发调试工具推荐。 感谢。
rn开发,xcode能识别到iphone,但是adb识别不到,开代理之后也能抓到包,有懂的大佬吗帮忙给个解决思路 iphone14 pro,系统版本ios17.1.1 macbook pro m1 14.1.1 "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241115/e540dcfb3e2db9be9bf09dc83dd1c9c6.png) 补充一下,小米手机是可以识别到的
ReactNative 中的tabview点击tab无法切换view, import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { View, StyleSheet, Dimensions, Text } from 'react-native'; import { TabView, SceneMap, TabBar } from 'react-native-tab-view'; type Route = { key: string; title: string; }; type State = { index: number; routes: Route[]; }; const initialTabState: State = { index: 0, routes: [ { key: 'tab1', title: 'Tab 1' }, { key: 'tab2', title: 'Tab 2' }, { key: 'tab3', title: 'Tab 3' }, { key: 'tab4', title: 'Tab 4' }, { key: 'tab5', title: 'Tab 5' }, { key: 'tab6', title: 'Tab 6' }, { key: 'tab7', title: 'Tab 7' }, { key: 'tab8', title: 'Tab 8' }, ], }; const FirstRoute = () => ( ); const SecondRoute = () => ( ); const ThirdRoute = () => ( ); const FourthRoute = () => ( ); const FifthRoute = () => ( ); const SixthRoute = () => ( ); const SeventhRoute = () => ( ); const EighthRoute = () => ( ); const TabScreen: React.FC = () => { const [tabState, setTabState] = useState(initialTabState); const renderScene = SceneMap({ '1': FirstRoute, '2': SecondRoute, '3': ThirdRoute, '4': FourthRoute, '5': FifthRoute, '6': SixthRoute, '7': SeventhRoute, '8': EighthRoute, }); const renderTabBar = (props: any) => ( { console.log(route) const index = initialTabState.routes.findIndex(item => item.key == route.key); handleIndexChange(index); }} /> ); const handleIndexChange = (index: number) => { setTabState({ ...tabState, index }); }; useEffect(() => { console.log(tabState.index); }, [tabState]) return ( ); }; const styles = StyleSheet.create({ scene: { flex: 1, }, tabStyle: { width: 'auto', }, indicatorStyle: { backgroundColor: '#000', }, tabBarStyle: { backgroundColor: '#fff', }, labelStyle: { color: '#000', }, }); export default TabScreen; "react": "18.2.0", "react-native": "0.72.6", "react-native-tab-view": "^3.5.1", 去除自定义tab改成原生的也不行
react-native项目中使用react-native-webview嵌入vue页面,两种方式,在不同机型上无效. 方式一:直接使用window.postMessage(例如在 vivo z3手机(android9) 上vue页面监听方法不执行) rn页面: function injectJavascriptFun(params) { const str = `(function() { window.postMessage(1); })()`; injectJavaScript(str); } vue页面: window.addEventListener('message', (event) => {}) 方式二:使用window.WebViewBridge.onMessage(例如在 小米手机(android13) 上vue页面监听方法不执行) rn页面: function injectJavascriptFun(params) { const str = `(function() { window.WebViewBridge.onMessage(${JSON.stringify(params)}); })()`; injectJavaScript(str); } injectJavascriptFun(sendData); vue页面: window.WebViewBridge = { onMessage:function (data){ store.commit('user/setRNWebview', data) } } const event = new Event('WebViewBridge') window.dispatchEvent(event); 以上两种方式在其他一些测试机例如iphone15pro、一加(android13),华为手机上都生效 ,该用什么区分调用两种方法呢?