react-native-ios

Refresh previous screen on goBack()

人盡茶涼 提交于 2019-12-03 08:08:11
问题 I am new to React Native. How can we refresh/reload previous screen when returning to it by calling goBack() ? Lets say we have 3 screens A, B, C: A -> B -> C When we run goBack() from screen C it goes back to screen B but with old state/data. How can we refresh it? The constructor doesn't get called 2nd time. 回答1: Yes, constructor is called only for the first time and you can't call it twice. First : But you can separate the data getter/setter from the constructor and put it in a function,

Xcode 11 Upgrade | Could not find iPhone X simulator | XRPackageModel 9.0.omo

有些话、适合烂在心里 提交于 2019-12-03 06:57:25
Anyone else getting this since upgrading from Xcode 10.3 to Xcode 11 when running react-native run-ios and any idea to get back up and running? CoreData: annotation: Failed to load optimized model at path '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsPackaging.framework/Versions/A/Resources/XRPackageModel.momd/XRPackageModel 9.0.omo' error Could not find iPhone X simulator I remember this happening before and amending: node_modules⁩ ▸ ⁨@react-native-community⁩ ▸ ⁨cli⁩ ▸ ⁨build⁩ ▸ ⁨commands⁩ ▸ ⁨runIOS⁩ ▸ findMatchingSimulator.js As a current

How to stop react-native link from linking a library with CocoaPods with it has a podspec?

无人久伴 提交于 2019-12-03 02:26:58
I need to use CocoaPods for a specific library. However I don't want to use it for any other because it usually forces me to add React and its dependencies to the Podfile as well, which is a nuisance and can lead to several issues as in previous experiences. In React Native documentation ( https://facebook.github.io/react-native/docs/linking-libraries-ios ) it is specifically said: If your iOS project is using CocoaPods (contains Podfile) and linked library has podspec file, then react-native link will link library using Podfile. To support non-trivial Podfiles add # Add new pods below this

Refresh previous screen on goBack()

Deadly 提交于 2019-12-02 23:12:52
I am new to React Native. How can we refresh/reload previous screen when returning to it by calling goBack() ? Lets say we have 3 screens A, B, C: A -> B -> C When we run goBack() from screen C it goes back to screen B but with old state/data. How can we refresh it? The constructor doesn't get called 2nd time. Yes, constructor is called only for the first time and you can't call it twice. First : But you can separate the data getter/setter from the constructor and put it in a function, this way you can pass the function down to the next Scene and whenever you're going back you may simply

Image is not showing in the iOS device after getting downloaded through rn-fetch-blob ( React native fetch blob)

不羁岁月 提交于 2019-12-02 20:27:53
问题 I am trying to download a small image using this particular code snippet : Plug in Used : "rn-fetch-blob": "^0.10.14" RNFetchBlob. config({ fileCache: true, }). fetch('GET', url, { //getting image URL from server // some headers .. }) .then((response) => { const base64Str = response.data; RNFetchBlob.fs .writeFile(imageLocation, base64Str, 'base64') .then(() => { console.log("Download successful"); }).catch((err) => { console.log('Failed to save file. ', err); }); variable imageLocation

Add object in NativeModules

点点圈 提交于 2019-12-02 16:11:29
问题 I would like to use https://github.com/dgladkov/react-native-image-rotate in react-native project I download it with yarn add react-native-image-rotate I link it with react-native link I import it in my component with import ImageRotate from 'react-native-image-rotate'; But when I try to use it I have a Cannot read property 'rotateImage' of undefined I put a break-point in node_modules/react-native-image-rotate/index.js on the line: const RCTImageRotateModule = NativeModules.ImageRotateModule

Xcode Archive build failed with react native project

隐身守侯 提交于 2019-12-01 18:52:17
Latest react / react-native update. Never had problem deploying my app to the appleStore since this morning. Been struggling with this for hours. Here is the error message I get when I try to Product->Archive: Ld /Users/angeliquesherpa/Library/Developer/Xcode/DerivedData/LesSherpas-exmzjsfkzoxzwcehsbzxjyhztxsa/Build/Intermediates.noindex/ArchiveIntermediates/LesSherpas/IntermediateBuildFilesPath/LesSherpas.build/Release-iphoneos/LesSherpas.build/Objects-normal/arm64/LesSherpas normal arm64 (in target: LesSherpas) cd /Users/angeliquesherpa/Terry/sherpas_mobile_app/ios export IPHONEOS_DEPLOYMENT

Xcode Archive build failed with react native project

自作多情 提交于 2019-12-01 17:49:23
问题 Latest react / react-native update. Never had problem deploying my app to the appleStore since this morning. Been struggling with this for hours. Here is the error message I get when I try to Product->Archive: Ld /Users/angeliquesherpa/Library/Developer/Xcode/DerivedData/LesSherpas-exmzjsfkzoxzwcehsbzxjyhztxsa/Build/Intermediates.noindex/ArchiveIntermediates/LesSherpas/IntermediateBuildFilesPath/LesSherpas.build/Release-iphoneos/LesSherpas.build/Objects-normal/arm64/LesSherpas normal arm64

React Native reload page

落爺英雄遲暮 提交于 2019-12-01 08:37:25
So I have an app with an activity. The app checks for Internet connection at the beginning. If there are no Internet connection, it will show a screen with a button to refresh the page. The problem is that my API calls (Axios) is located on componentDidMount() where it's called only once after the first render. Is there any way I can reload the page so it calls componentDidMount again? I mean like total refresh. I am using EXPO btw. Any help is appreciated. Sorry there are no examples, I just wanted to get the idea if possible You can force update the component. Check this: https://reactjs.org

React native detect IOS status bar height when calling / sharing hotspot?

半城伤御伤魂 提交于 2019-12-01 08:22:08
Status bar height changes when calling or sharing personal hotspot on ios and overlaps view, how to detect status bar height when it changes? I've faced this challenge and haven't found answers on stackoverflow / github issues. I've come up with my own solution, and post it so this can save some time for others. import { NativeModules, StatusBarIOS } from 'react-native' const { StatusBarManager } = NativeModules componentDidMount () { if (Platform.OS === 'ios') { StatusBarManager.getHeight(response => this.setState({statusBarHeight: response.height}) ) this.listener = StatusBarIOS.addListener(