Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all 16907 articles
Browse latest View live

stopping at the splash react native

$
0
0

stopping at the splash screen even though no error has occurred.

I did react-native run-ios.It's success. but stopping at the splash screen.

I use react native .

I try it. and reload.

watchman watch-del-all && rm -rf node_modules/ && rm -rf ios/build && npm cache clean --force && npm install && rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/haste-* && rm -rf $TMPDIR/metro-* && rm -rf ~/Library/Developer/Xcode/DerivedData/ ```[Did this][1]but ,the result does not change.  [1]: https://qiita.com/yuitnnn/items/62a8c95de14f494ee15f

React Native error pod install, Debian 10

$
0
0

React Native 0.62,OS Debian 10 Buster

I'm trying to run ios emulator for React Native project. For that I run 'pod install' within ios folder and caught error:

..../configure --host arm-apple-darwin...checking for arm-apple-darwin-gcc...  -arch armv7 -isysroot checking whether the C compiler works... no/usr/bin/bash: line 24: xcrun: command not found/usr/bin/bash: line 24: xcrun: command not found/home/user/Library/Caches/CocoaPods/Pods/Release/Flipper-Glog/0.3.6-1dfd6/missing: Unknown `--is-lightweight' optionTry `/home/user/Library/Caches/CocoaPods/Pods/Release/Flipper-Glog/0.3.6-1dfd6/missing --help' for more informationconfigure: WARNING: 'missing' script is too old or missingconfigure: error: in `/home/user/Library/Caches/CocoaPods/Pods/Release/Flipper-Glog/0.3.6-1dfd6':configure: error: C compiler cannot create executablesSee `config.log' for more details

How fix it?

Which programming language to choose for WebView based app?

$
0
0

I built my responsive online game using html&css, javascript and php. I'm planning to export it as an android application. Because I don't have enough knowledge of languages for android development (I used react native but I'm not comfortable with it), I'll try to export my app in WebView / I'll make hybrid application.

I built it in React Native, it works, but I'm not happy with speed. It looks like there is 0.5s delay every time when I click button or slide.

My question is: Which programming language will do it in best way? Is it possible to speed up react native webview a little bit?

How to make a "Rate this app" link in React Native app?

$
0
0

How to properly link a user to reviews page at App Store app in React Native application on iOS?

React Native Link for React Native .60 +

$
0
0

This is still something that is required, I see this message all the time, but it's completely invalid from what I have experienced. Almost every package I work with, I still have to run the react-native link.

enter image description here

Can anyone tell me what's up with this? Is it just particular packages, or why do I still need to run react-native link all the time, when it tells me I shouldn't run it. I mean, it's really just adding it to the pod file for iOS and gradle for Android.

Anyone else experiencing this?

Make overlapping views touchable to trigger onPress in react-native

$
0
0

I have a view which has overlapping views, the root view is an absolute view while the child views which is the buttons shown below is relative, the upper side of the buttons is touchable but the bottom side marked in yellow is not, therefore onPress is not triggered:

enter image description here

Code used for this:

render() {  return (<Card elevation={4}><Card.Cover        resizeMode="contain"        source={{          uri:"https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcTRDxz5NrZ1gdQOqyodN9Qudpw9Z2HTMsfzBm-D1vURyNQdJtNFJ6OLbS_wTlwr15b36BSDddr9&usqp=CAc",        }}></Card.Cover><Card.Content><Title>Maverick Drone</Title></Card.Content><View        style={{          flex: 1,          position: "absolute",          bottom: "-8%",          right: 0,          flexDirection: "row",        }}><View          style={{            elevation: 6,            shadowOffset: 0.8,            position: "relative",            justifyContent: "center",            alignItems: "center",            backgroundColor: "red",            width: 45,            height: 45,            borderRadius: 80,          }}><TouchableRipple            borderless            rippleColor={Colors.purple600}            style={{ justifyContent: "center", alignItems: "center" }}            onPress={this.onDecrement}><MatIcon color="white" size={32} name="minus"></MatIcon></TouchableRipple></View><View style={{ padding: 8 }}></View><View          style={{            elevation: 6,            shadowOffset: 0.8,            justifyContent: "center",            alignItems: "center",            borderRadius: 20,            backgroundColor: "darkred",            width: 60,          }}><Text style={{ fontSize: 18, fontWeight: "bold", color: "white" }}>            {this.state.quantity}</Text></View><View style={{ padding: 8 }}></View><View          style={{            elevation: 6,            shadowOffset: 0.8,            position: "relative",            justifyContent: "center",            alignItems: "center",            backgroundColor: "red",            width: 45,            height: 45,            borderRadius: 80,          }}><TouchableRipple            borderless            rippleColor={Colors.purple600}            style={{ justifyContent: "center", alignItems: "center" }}            onPress={this.onIncrement}><MatIcon color="white" size={32} name="plus"></MatIcon></TouchableRipple></View></View></Card>  );}

I have read online websites that this is an issue with react-native it does not support overlapping views.Any workaround that can be done to avoid this kind of issue or bug in react-native?

what is 'use_native_modules!' in podfile?

$
0
0

I have been into the process of upgrading react-native version from 0.59.1 to 0.62.0, since RN 0.60.0 all the native libraries are linked automatically using pods. I had to include these lines in podfile require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' and use_native_modules!, why is it necessary to add these lines ?

How to change iOS slider value through Appium/WebdriverIO

$
0
0

I am testing my React Native app using Appium and WebdriverIO. Having difficulty in changing slider values.

Normally in XCUITest I can easily achieve this using the following code:

app.sliders["slider-red"].adjust(toNormalizedSliderPosition: 0)

How to do the equivalent in Appium/WebdriverIO? I read somewhere that I should call sendKeys(). I tried the following:

$('~slider-red').sendKeys(['0']);

But it is giving me the following error:

invalid element state: Error Domain=com.facebook.WebDriverAgent Code=1 "The on-screen keyboard must be present to send keys"

It looks like sendKeys is for input fields, not for sliders!


[react native][ios][react-native-background-fetch] dont't work on ios

$
0
0

I've implemented react-native-background-fetch in my app, and it works well on Android, but not on ios - Xcode Version 11.4

Simulate Background Fetch works. I noticed also that Background Fetch triggers once on the first application start, but not anymore. On Android Background Fetch triggers every 15 min.

My configuration is:

react-native: 0.62.1

react-native-background-fetch: 2.8.0

Here is my code:

App.js

class App extends Component {  componentDidMount () {    ...    newPostNotificationService.initNotifications()    ...

newPostsNotificationSevice.js

initNotifications = async () => {  this.configureNotifications() // Configures PushNotification  BackgroundFetch.registerHeadlessTask(this.fetchNewPosts)  BackgroundFetch.configure({    minimumFetchInterval: 15,    stopOnTerminate: false,    startOnBoot: true,    enableHeadless: true  }, this.fetchNewPosts,    (error) => {      console.log(error, '[js] RNBackgroundFetch failed to start')    })  BackgroundFetch.status((status) => {    switch (status) {      case BackgroundFetch.STATUS_RESTRICTED:        console.log('BackgroundFetch restricted')        break      case BackgroundFetch.STATUS_DENIED:        console.log('BackgroundFetch denied')        break      case BackgroundFetch.STATUS_AVAILABLE:        console.log('BackgroundFetch is enabled')        break    }  })}

fetchNewPosts Method in newPostsNotificationSevice.js

async fetchNewPosts(taskId) {  console.log('BackgroundFetch Start', taskId)  if (AppState.currentState === 'active') {    BackgroundFetch.finish(taskId)    return  }  dataStorageService.getSettings().then(async (settings) => {    if (!settings.notifications) {      BackgroundFetch.finish(taskId)      return    }    const url = config.API_URL + config.API_ENDPOINTS.POSTS +'&per_page=1&page=1'    let data    if (!config.DATA_MOCK.NEW_POSTS) {      data = await fetch(url)        .then((response) => {          return response.json()        })        .catch((error) => {          console.error(error)        })    } else {      data = postsMock.posts    }    data = data.map(item => {      return new PostShort(item)    })    data = data.filter(item => {      return item.sendPush    })    if (data.length === 0) {      BackgroundFetch.finish(taskId)    }    dataStorageService.getPostsIndex().then(postsIndex => {      if (postsIndex.length > 0 && postsIndex.indexOf(data[0].id) !== -1) {        BackgroundFetch.finish(taskId)        return      }      dataStorageService.getNotificationsIndex().then(notificationsIndex => {        if (notificationsIndex.indexOf(data[0].id) !== -1) {          BackgroundFetch.finish(taskId)          return        }        const notificationBody = entities.decode(data[0].title)        const notificationNumber = notificationsIndex.length + 1        console.log('notificationNumber', notificationNumber)        PushNotification.localNotification({          title: config.NOTIFICATION_TITLE, // (optional)          message: notificationBody, // (required)          playSound: true, // (optional) default: true          soundName: 'default',          number: notificationNumber,          id: notificationNumber.toString()        })        dataStorageService.insertIntoNotificationsIndex([data[0].id])        BackgroundFetch.finish(taskId)      })    })  })}

I made iOS setup following this instructions: https://github.com/transistorsoft/react-native-background-fetch/blob/HEAD/docs/INSTALL-AUTO-IOS.md

Why Background Fetch doesn't trigger periodically on iOS like on Android does?

ld: library not found for -lRCTBlob

$
0
0

EDIT START:

I found a solution:

in your XCode you need to found Build phases link, then Link Binary With Libraries select lRCTBlob and click -(minus) in the end of list

EDIT END

currently trying to upgrade react-native to 0.61.5 from 0.59.10 and faced this error:

ld: library not found for -lRCTBlob

clang: error: linker command failed with exit code 1 (use -v to see invocation)

I've tried pod install, pod install --repo-update, pod update and that:

  1. Clear the cache of pod with:

    1.1 rm -rf ~/Library/Caches/CocoaPods

    1.2 rm -rf Pods

    1.3 rm -rf ~/Library/Developer/Xcode/DerivedData/*

    1.4 pod deintegrate

    1.5 pod setup

  2. And delete the project's Pods directory. The location of it is project directory > ios > Pods.
  3. Then in the project directory > ios location, install pod with pod install
  4. And react-native run-ios in project directory.

Any help welcome!

How do I use a prepopulated SQLite DB with Expo on Android?

$
0
0

I'm trying to use a prepopulated SQLite DB for my react native app. I'm using Expo and the downloadAsync() Function to load my DB from my assets folder. This works as expected on IOS, as I can load the DB and retrieve the data.

On Android however I just can't get this to work. The db file is there in the internal storage of my emulator, but every time I try to retrieve data, an error occurs since 'there is no such table'.

My guess is that SQLite doesn't properly search for my db but instead creates a new one, where my tables are obviously missing.

I've been trying for over 7 hours now, so I appreciate any kind of help.

Folder structure:

App.js-assets--db---db.db-src--connection---connectionClass

App.js

const App = () => {    const [dbLoaded, setDbLoaded] = useState(false);       if(!dbLoaded){        downloadDB().then((value) => setDbLoaded(value));        return <></>    } else {        return (<Navigation/>        );    }};

ConnectionClass.js

export const downloadDB = async () => {    await FileSystem.deleteAsync(`${FileSystem.documentDirectory}SQLite`, {idempotent : true});    await FileSystem.makeDirectoryAsync(`${FileSystem.documentDirectory}SQLite`, {intermediates: true });    return await FileSystem.downloadAsync(        Asset.fromModule(require('../../assets/db/WaKanji.db')).uri,        `${FileSystem.documentDirectory}SQLite/WaKanji.db`    ).then(({status}) => {        if(status === 200){                           return true        }        return false    }).catch(error => {        console.log('Err\n'+ error);        return false;    });};

react-native - Pod install stucked at cloning spec repo

$
0
0

All in a sudden when i tried to add new pods to the Podfile and tried to install them, the process is getting infinite!

Here is the log:

  PreparingAnalyzing dependenciesInspecting targets to integrate  Using `ARCHS` setting to build architectures of target `Pods-MyProject`: (``)Fetching external sources-> Fetching podspec for `BVLinearGradient` from `../node_modules/react-native-linear-gradient`-> Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`-> Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`-> Fetching podspec for `RNCAsyncStorage` from `../node_modules/@react-native-community/async-storage`-> Fetching podspec for `RNDeviceInfo` from `../node_modules/react-native-device-info`-> Fetching podspec for `RNFBApp` from `../node_modules/@react-native-firebase/app`-> Fetching podspec for `RNFBMessaging` from `../node_modules/@react-native-firebase/messaging`-> Fetching podspec for `RNFS` from `../node_modules/react-native-fs`-> Fetching podspec for `RNKeychain` from `../node_modules/react-native-keychain`-> Fetching podspec for `RNOS` from `../node_modules/react-native-os`-> Fetching podspec for `RNSVG` from `../node_modules/react-native-svg`-> Fetching podspec for `RNScrypt` from `../node_modules/react-native-scrypt`-> Fetching podspec for `RNSecureRandom` from `../node_modules/react-native-securerandom`-> Fetching podspec for `RNShare` from `../node_modules/react-native-share`-> Fetching podspec for `RNVectorIcons` from `../node_modules/react-native-vector-icons`-> Fetching podspec for `React` from `../node_modules/react-native`-> Fetching podspec for `TcpSockets` from `../node_modules/react-native-tcp`-> Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`-> Fetching podspec for `react-native-aes` from `../node_modules/react-native-aes-crypto`-> Fetching podspec for `react-native-google-maps` from `../node_modules/react-native-maps`-> Fetching podspec for `react-native-image-picker` from `../node_modules/react-native-image-picker`-> Fetching podspec for `react-native-image-resizer` from `../node_modules/react-native-image-resizer`-> Fetching podspec for `react-native-maps` from `../node_modules/react-native-maps`-> Fetching podspec for `react-native-randombytes` from `../node_modules/react-native-randombytes`-> Fetching podspec for `react-native-udp` from `../node_modules/react-native-udp`-> Fetching podspec for `yoga` from `../node_modules/react-native/ReactCommon/yoga`Resolving dependencies of `Podfile`  CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because  checking is only perfomed in repo updateCloning spec repo `cocoapods` from `https://github.com/CocoaPods/Specs.git`  $ /usr/bin/git clone https://github.com/CocoaPods/Specs.git -- cocoapods  Cloning into 'cocoapods'...

And it gets stuck here and when i checked the activity indicator a process called git-remote-https is continuosly fetching the source from the repo, but it doesnt end either! Why so?? How to fix it

React Native for iOS: "network request failed" for one URL but not others

$
0
0

In my React Native app, I'm trying to make an API call with this code:

test = async () => {    try {      let a = await fetch('https://rxapitest.alliancepharmacygroup.ca:12345/', {        method: 'GET',      }).then(response => {        console.log("success")      })    } catch(err) {      console.log("error")    }  }

On Android this works fine. In Postman the request works fine. And when I replace the URL with https://google.com or something, it works fine. So it seems that the problem is with this particular URL for iOS only.

Here's my stacktrace:

enter image description here

Does anyone know how I can approach this?

Open react native project in xcode

$
0
0

I'm sure I'm missing something simple. I have a React Native project working and I'm attempting to get it on the app stores. Following those instructions, after I have created my provisioning profile in the Apple Developer Dashboard, it says to double click the developer provisioning profile to launch xcode. It's these instructions exactly:

Now find the files you just downloaded on your computer, and double-click each of them in turn, causing Xcode to launch. Verify the profiles are there by opening a project or starting a new one for this test.

So I double-click my file, and xcode does launch but no windows open up. I do not have an xcode project for my react native app so I have nothing to open. There is no menus for 'build settings' or 'general' so I'm not sure how to proceed.

For reference, here is my react native directory structure:

my_project/    .expo/    assets/    node_modules/    src/    .bablerc    .gitignore    App.js    app.json    package-lock.json    package.json    README.md

Did I miss a step somewhere? How do I get an xcode project from this?

Network request failed - Expo React Native

$
0
0

This is really annoying me. if i use http://my-domain.com its work with out Network request failed, but https://my-domain.com its keep giving me Network request failed error.

i been looking online and still not fix this issue. Please help.

package.json

"dependencies": {"@expo/vector-icons": "~10.0.6","@react-native-community/masked-view": "0.1.6","@react-navigation/bottom-tabs": "^5.0.0","@react-navigation/native": "^5.0.0","@react-navigation/stack": "^5.0.0","@react-navigation/web": "~1.0.0-alpha.9","expo": "~37.0.3","expo-asset": "~8.1.3","expo-constants": "~9.0.0","expo-font": "~8.1.0","expo-web-browser": "~8.1.0","react": "~16.9.0","react-dom": "~16.9.0","react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz","react-native-gesture-handler": "~1.6.0","react-native-iphone-x-helper": "^1.2.1","react-native-modalize": "^1.3.7-rc.19","react-native-safe-area-context": "0.7.3","react-native-screens": "~2.2.0","react-native-web": "~0.11.7"

},

Fetch code

const [contents, setContents] = useState([]);const fetchChannelContent = (slug) => {    fetch(Http.api+"/channel/"+slug)        .then((response) => response.json())        .then((json) => {            setContents(json.channel.content);        })        .catch((error) => {            console.error(error);        });};useEffect(() => {    fetchChannelContent(url)}, []);[![enter image description here][1]][1]

[1]:

Http Class

export default {api: "https://my-domain.com"

}


React Native: Way to restart apps in users devices remotely without injecting code

$
0
0

I have a React Native app.

I realized I didn't inject any code to restart app in certain condition
(e.g. when update detected, force restart, reload)

Is there anyway to apply updates to apps in users devices?
Like by command line specifying device id or something?

Thank you.

How to set point selection on the chart in react-native-charts-wrapper?

$
0
0

I have a LineChart on my app from react-native-charts-wrapper and usually after the user taps on the chart the dates's bar appears on the chart like this:

enter image description here

But i need to set like just point selection, like this:

enter image description here

But i could not find any ways how to make it. Can somebody recommend me please how can i do it?

TouchableOpacity in absolute position view on ios

$
0
0

I'm building the react native project.This code works well on Android but doesn't work well on ios.if I touch the first half of the button, it works, but touch doesn't work on the end of the button.

<View style={{backgroundColor: 'red', position: 'absolute', bottom: 0, alignSelf: 'center', width: 300}}><TouchableOpacity onPress={()=>{console.log('clicked!');}><View style={{flex: 1, backgroundColor: 'blue', width: 300}}><Text style={{flex: 1, backgroundColor: 'green', width: '100%', textAlign: 'center'}}>            Click Me!</Text></View></TouchableOpacity></View>

react-native run-ios can not find any simulator

$
0
0

I have been facing an issue where 'react-native run-ios' can not start, regardless of the simulator I add to the --simulator argument.XCode has the correct location for the 'command line tools'

I am always getting the error:Could not find iPhone X simulator

Error: Could not find iPhone X simulator    at resolve (/Users/eric/.../swim/node_modules/react-native/local-cli/runIOS/runIOS.js:149:13)    at new Promise (<anonymous>)    at runOnSimulator (/Users/eric/.../swim/node_modules/react-native/local-cli/runIOS/runIOS.js:134:10)    at Object.runIOS [as func] (/Users/eric/.../swim/node_modules/react-native/local-cli/runIOS/runIOS.js:106:12)    at Promise.resolve.then (/Users/eric/.../swim/node_modules/react-native/local-cli/cliEntry.js:117:22)

react-native info

>   React Native Environment Info:>     System:>       OS: macOS 10.14.2>       CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz>       Memory: 6.76 GB / 32.00 GB>       Shell: 3.2.57 - /bin/bash>     Binaries:>       Node: 10.15.0 - /usr/local/bin/node>       Yarn: 1.13.0 - /usr/local/bin/yarn>       npm: 6.4.1 - /usr/local/bin/npm>     SDKs:>       iOS SDK:>         Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1>     IDEs:>       Android Studio: 3.1 AI-173.4819257>       Xcode: 10.1/10B61 - /usr/bin/xcodebuild>     npmPackages:>       react: 16.6.3 => 16.6.3 >       react-native: 0.57.8 => 0.57.8 >     npmGlobalPackages:>       create-react-native-app: 1.0.0>       react-native-cli: 2.0.1>       react-native-git-upgrade: 0.2.7

How to run a function when app goes to background or died and stop it when comes to foreground (react-native)?

$
0
0

I want to fetchdata from server when my app closed (in background || died) and stop fetching when it again opened.

So I need to call a function right after app goes to backgroundstate or even force closed (died) and stop it when comes again to foreground.

How can I do it with react-native to be work on both Android and IOS?

I prefer if it is possible without any third party libs, because most third party libs are not maintained in long term.

Viewing all 16907 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>