react-native

How to use drawer navigator and tab navigator simultaneously?

一个人想着一个人 提交于 2021-02-17 06:14:05
问题 This is my tab navigator: <Tab.Navigator initialRouteName="Home" backBehavior="initialRoute"> <Tab.Screen name="Science" component={Science} options={{ tabBarLabel: 'Science', tabBarIcon: ({color, size}) => ( <Image source={require('../../assets/images/science-tab.png')} /> ), }} /> <Tab.Screen name="Dashboard" component={Dashboard} /> </Tab.Navigator> This is DrawerNavigator: <Drawer.Navigator initialRouteName="Home"> <Drawer.Screen name="Home" component={HomeScreen} /> <Drawer.Screen name=

'useEffect' hook only fires once?

流过昼夜 提交于 2021-02-17 05:51:21
问题 I am working of a Guessing Game for 'React Native' where the user enters a number and the phone tries to guess it. Each time the phone generates a guess the user can click Greater/Lower. When the user entered number and the computer made guess equal each other we are taken to the game over screen. The game over screen is not rendering. The logic to render the game over screen is placed inside of a useEffect() Problem useEffect is only fired once during the mounting phase and never again?

Unable to resolve module `../../../../src/redux` from `node_modules/react-redux/lib/connect/mapDispatchToProps.js

强颜欢笑 提交于 2021-02-17 05:48:06
问题 I am trying to add redux with redux toolkit to an existing react native app with my first attempt at atomic design. I have wrapped my index.js components in a <Provider> per the docs but it seems like react-redux is searching for a location called 'src/redux' which is throwing an error. I originally tried to combine all redux functionality within an 'src/redux' folder and used jsonconfig.json to alias '_redux' to path 'src/redux' with subfolders and index.js files pointing to subfolders

Unable to resolve module `../../../../src/redux` from `node_modules/react-redux/lib/connect/mapDispatchToProps.js

最后都变了- 提交于 2021-02-17 05:48:05
问题 I am trying to add redux with redux toolkit to an existing react native app with my first attempt at atomic design. I have wrapped my index.js components in a <Provider> per the docs but it seems like react-redux is searching for a location called 'src/redux' which is throwing an error. I originally tried to combine all redux functionality within an 'src/redux' folder and used jsonconfig.json to alias '_redux' to path 'src/redux' with subfolders and index.js files pointing to subfolders

React Native in yarn workspaces not resolving external packages

痞子三分冷 提交于 2021-02-17 04:51:13
问题 I am using yarn workspaces to create monorepo for react and react-native . I tried to add redux to @app/common and it works fine with react , but it is not resolving in native. You can see the source at https://github.com/Faisal-Manzer/react-and-react-native-monorepo/tree/08-redux. When loading bundle it is giving the following error. error: Error: Unable to resolve module `redux` from `../common/reducers/index.js`: redux could not be found within the project or in these directories: ../..

Keyboard Language in React Native iOS?

情到浓时终转凉″ 提交于 2021-02-17 01:57:12
问题 Is there any way to know the language of the Keyboard in React-Native iOS apps? Cause I want to switch TextInput direction automatically based on current language 回答1: You can get the devide locale using: import { NativeModules } from 'react-native' const locale = NativeModules.SettingsManager.settings.AppleLocale || NativeModules.SettingsManager.settings.AppleLanguages[0] It should produce something like: "fr_FR" The keyboard language itself, i didn't found anything until now. Edit You can

React native navigation 5 passing updated component

不问归期 提交于 2021-02-15 07:51:26
问题 I am new to react native and its navigation modules. I have a simple dashboard.js file where I am using tab navigator like this - <Tabs.Navigator tabBarOptions={{ activeTintColor: '#ff5757' }}> <Tabs.Screen options={{ tabBarIcon: ({ color }) => <Icon name='star-border' size={30} padding={15} color={color} />,}} name={'Orders'} component={Order} initialParams={{user}} /> <Tabs.Screen component= {AnotherComponent} /> As you can see I am passing InitialParams where I have user props. And I can

Cropping functionality(react-easy-crop) is not working when i try to upload an image I am unable to edit or resize the image adjustment

点点圈 提交于 2021-02-15 07:29:51
问题 i had tried to implement to upload the multiple images but when i upload an image the image get randomly uploaded without cropping .so i had implemented react-easy-crop so when i tried to open the image cropping part is not opening i have tried the state method to open image but i am not understanding where i am getting wrong . i had implement image cropping before uploading an image . using react-easy-crop but its directly uploading the image without cropping below is the sandbox and code.

React Native: Inserting new object inside Array

戏子无情 提交于 2021-02-15 07:13:38
问题 after successfully implementing sockets, i can now listen to my event from one screen to another. My problem now is that i want to display the new object that i obtained inside my flatlist. Here is the new msg object: messages: Object { "conversationId": 33, "message": "Heyy", "receiverId": 43, "senderId": 53, } Here is my code: const [listings, setListings] = useState([]); const loadListings = async () => { setLoading(true); const response = await messagesApi.getMessages(); setLoading(false)

React Native: Inserting new object inside Array

☆樱花仙子☆ 提交于 2021-02-15 07:12:40
问题 after successfully implementing sockets, i can now listen to my event from one screen to another. My problem now is that i want to display the new object that i obtained inside my flatlist. Here is the new msg object: messages: Object { "conversationId": 33, "message": "Heyy", "receiverId": 43, "senderId": 53, } Here is my code: const [listings, setListings] = useState([]); const loadListings = async () => { setLoading(true); const response = await messagesApi.getMessages(); setLoading(false)