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

web scraping on react native iOS app using recurring background service [closed]

$
0
0

I have been working on a project which requires me to scrape myactivity.google.com and show the data in a dashboard. This entire process needs to be done on the client(mobile app). Developing a React Native an iOS app, which would implement a webview where I can open myactivity.google.com, inject javascript code to scrape data, theoretically. Also, I need this to run every one hour in the background(as a background service or someting) without any user intervention so that the data on dashboard is always updated.

I want to load a webview in the background, without the app even been open, and schedule a background service to do all the process. But I cannot find a way to load a web page in the background and scrape data.

I have found a few libraries in React Native, which help in running background services. But they are all for app data refresh or a simple API call. My requirement, however, is different. I also tried accessing cookies in UI webview and pass them to a background service to load the HTML from myactivity.google.com using those cookies. But this approach did not work either.

To all the React Native/ iOS developers, I need help and suggestions to get this done. Any guidance is highly appreciated. This is my approach if someone can suggest some other way, I am open to discussions.


React native Webview blocked after Screen Lock (IOS)

$
0
0

I'm working on an ios react native app, I'm using webview to get data periodically, and use it in my app, but when I lock my iphone device, the webview stop sending data to react native.


onWebViewLoad(){
   setInterval(function(){
      this.refs.webview.injectJavaScript('window.ReactNativeWebView.postMessage(window.getData());');
   },10000);
}

handleMessage(event){
   // receive data
   //doSomthing(event.nativeEvent.data)
}

// 
              ...
              <WebView
                source={{ uri: this.state.myPage}}
                javaScriptEnabled={true}
                startInLoadingState={true}
                onLoad={this.onWebViewLoad}
                ref="webview"
                onMessage={this.handleMessage}
                />
            ...

Note : code is working fine when app in foreground or background , but when I open the app and lock the screen the webview stops sending data.

is there a way to make the webview send data after screen lock.

Endpoints aren't eligible in amazon pinpoint campaign creation

$
0
0

When I try to create a campaign in amazon pinpoint no eligible endpoints show up in the segment creation section. Even though I have a device successfully receiving push notifications from the test messaging section.

I have implemented iOS push notifications for my react-native app exactly as shown in the documentation (https://aws-amplify.github.io/docs/js/push-notifications). Everything works without any errors on the frontend and the backend. When I run the code:

PushNotification.onRegister((token) => console.log(token)); 

I successfully receive the app token. I can even receive push notifications from the test messaging section by using the token generated from the onRegister function.

However when I try to create a campaign in amazon pinpoint. I cannot get farther than the create segment section because despite there being 6 total endpoints, there are 0 eligible endpoints. Why are my endpoints ineligible? I have tested on a device. I have tested in a simulator. I tried changing the IAM access of my auth and un auth roles to

"mobiletargeting:*"

so that they have full access to pinpoint.

What am I missing? Why are my endpoints ineligible?

In all of the tutorials that I have gone through. The segment automatically recognizes that the test device is eligible. Why is this not working for my project?

How to expand a row on the click of a Button?

$
0
0

I'm using the react-native-nested-list-view library.I was able to construct a tree-view but by default the expand and collapse in the tree view is done on click of the entire row. But my requirement is to expand and collapse on the click of '>' and '\/' buttons respectively. library used: "react-native-nested-listview": "^0.8.0". Please help me with this issue.

renderNestedListView = (chapter) => {
        return (
            <NestedListView
                data={chapter}
                getChildrenName={(node) => 'section'}
                onNodePressed={(node) => this.handleNodeClick(node)}
                renderNode={(node, level) => (
                    <NestedRow
                        level={level}
                        style={{ borderColor: 'black', borderWidth: 0.5 }}
                        paddingLeftIncrement={20}
                    >

                        <Text>
                            {
                                node['chapterTitle'] === undefined ? readProdDescAndCreateView(node['sectionTitle'])
                                    : node['chapterTitle']
                            }
                            {(node['section'] !== undefined
                                && Object.values(node['section']).length !== 0) && this.getExpandOrCollapse(node)}
                        </Text>
                    </NestedRow>
                )}
            />
        )

file not found

$
0
0

I am Using cocoapods to install react native and react. I just want to use a toast component(https://www.npmjs.com/package/react-native-simple-toast) which does ti have a cocoapods Installation. when i install and and run the app I am getting an error "" file not found error. I have added header search path but still getting this error. 1)error enter image description here

2)react-native-simple-toast xcode project Header search path enter image description here

3) Main project Header search path enter image description here

React-Native integration Support for V2 Pro device SunMI

Expo iOS Build Not Working--"Could Not Receive Latest API Key from App Store Connect"

$
0
0

I am currently in the process of trying to build my first app using Expo-cli. I am on Windows 10. I have an Apple Developer account and am just trying to build for iOS at the moment. However, whenever I run "expo build:ios" I get the following errors:

Connection reset by peer - SSL_connect
>>Error while gathering & validating credentials
>>Error: Reason:Unknown reason, raw:"Could not receive latest API key from App Store Connect, this might be a server issue.">>Reason:Unknown reason, raw:"Could not receive latest API key from App Store Connect, this might be a server issue."

When I run "set EXPO_DEBUG=true expo build:ios" and enter my Apple credentials, I get the following information:

Error: Reason:Unknown reason, raw:"Could not receive latest API key from App Store Connect, this might be a server issue."
    at Object._callee4$ (C:\expo-cli@2.6.14\src\commands\build\auth.js:135:11)
    at tryCatch (C:\Users\danie\AppData\Roaming\npm\node_modules\expo-cli\node_modules\regenerator-runtime\runtime.js:62:40)
    at Generator.invoke [as _invoke] (C:\Users\danie\AppData\Roaming\npm\node_modules\expo-cli\node_modules\regenerator-runtime\runtime.js:296:22)
    at Generator.prototype.(anonymous function) [as next] (C:\Users\danie\AppData\Roaming\npm\node_modules\expo-cli\node_modules\regenerator-runtime\runtime.js:114:21)
    at step (C:\Users\danie\AppData\Roaming\npm\node_modules\expo-cli\node_modules\babel-runtime\helpers\asyncToGenerator.js:17:30)
    at C:\Users\danie\AppData\Roaming\npm\node_modules\expo-cli\node_modules\babel-runtime\helpers\asyncToGenerator.js:28:13
    at process._tickCallback (internal/process/next_tick.js:68:7)

I have tried running the server and build on multiple networks with no luck. I have not found any other questions similar to this on any platform.

Does anyone have any ideas of what I can do to solve this issue? Thanks in advance!

React Native fingerprint authentication for android and ios both

$
0
0

I have built an android app using fingerprint authentication in Android Studio. I need to build the same thing but using React Native for android and iOS. How to go for it?


Deploying React Native Apps directly to devices for testing

$
0
0

I'm looking into the best ways to deploy React Native apps to devices for testing. We don't want to put the app on the app store yet, but we do want the app to be downloadable to, say, an iPad.

What is the best way to do this? Do I need a testing platform or something like diawi? Or can I just put the file in an email and install it from there?

Push notifications IOS react native NSDictionary error

$
0
0

I used this library to create push notifications in my react native app.

https://github.com/zo0r/react-native-push-notification .

I tried to send a local notification, the code is :

localNotif() {
    this.lastId++;
    PushNotification.localNotification({
      /* Android Only Properties */
      id: ''+this.lastId, // (optional) Valid unique 32 bit integer specified as string. default: Autogenerated Unique ID
      ticker: "My Notification Ticker", // (optional)
      autoCancel: true, // (optional) default: true
      largeIcon: "ic_launcher", // (optional) default: "ic_launcher"
      smallIcon: "ic_notification", // (optional) default: "ic_notification" with fallback for "ic_launcher"
      bigText: "My big text that will be shown when notification is expanded", // (optional) default: "message" prop
      subText: "This is a subText", // (optional) default: none
      color: "red", // (optional) default: system default
      vibrate: true, // (optional) default: true
      vibration: 300, // vibration length in milliseconds, ignored if vibrate=false, default: 1000
      tag: 'some_tag', // (optional) add tag to message
      group: "group", // (optional) add group to message
      ongoing: false, // (optional) set whether this is an "ongoing" notification

      /* iOS only properties */
      alertAction: 'view', // (optional) default: view
      category: null, // (optional) default: null
      userInfo: null, // (optional) default: null (object containing additional notification data)

      /* iOS and Android properties */
      title: "Local Notification", // (optional)
      message: "My Notification Message", // (required)
      playSound: false, // (optional) default: true
      soundName: 'default', // (optional) Sound to play when the notification is shown. Value of 'default' plays the default sound. It can be set to a custom sound such as 'android.resource://com.xyz/raw/my_sound'. It will look for the 'my_sound' audio file in 'res/raw' directory and play it. default: 'default' (default sound is played)
      number: '10', // (optional) Valid 32 bit integer specified as string. default: none (Cannot be zero)
      actions: '["Yes", "No"]',  // (Android only) See the doc for notification actions to know more
    });
  }

I got this error :

JSON value of type NSNull cannot be converted to NSDisctionary

Can't dismiss menu selection IOS - React Native

$
0
0

I have an issue with the react-native-selection-menu: https://github.com/prscX/react-native-selection-menu

On IOS it's impossible to dismiss the menu without clicking on a value. I want to dismiss it when the user click outside of it or at least add a button cancel. By the way it works well on Android.

It seems this component doesn't take a props like isVisible so I can't dismiss it with a change in the state.

There is my code:

onPress(props) {
    RNSelectionMenu.Show({
      values: ['One', 'Two', 'Three', 'Four', 'Five'],
      selectedValues: [],
      selectionType: 0,
      title: 'Browse by category',
      presentationType: 0,
      enableSearch: false,
      cancellable: true,
      onSelection: selectedValues => {
        console.log('Selected Values: ' + selectedValues);
      },
      isVisible: false,
      // searchTintColor: "#FFFFFF",
    });
  }

Any help will be appreciated :) Thanks!

How to create and save file to Files application (iOS platform)

$
0
0

I need to create PDF-file (done) and save it to Files application, so user can access it anytime outside of my app. I tried rn-fetch-blob and react-native-fs packages and they worked fine for Android, but for iOS they can only create files to internal app storage (so files are not created in external storage, i.e. not in iOS Files application). What options do I have to save my created files to Files application? I know that it is possible, i.g. Slack app allows saving files to Files app.

React Native AsyncStorage storing values other than strings

$
0
0

Is there any way to store values other than strings with AsyncStorage? I want to store simple boolean values for example.

AsyncStorage.setItem('key', 'ok');

Is no problem, but:

AsyncStorage.setItem('key', false);

Does not work..

Value for title can not be cast from ReadablenativeMap to string

$
0
0
InsertDataToServer = () => {
const { pinValue1 } = this.state;
const { pinValue2 } = this.state;
const { pinValue3 } = this.state;
const { pinValue4 } = this.state;
var String_3 = pinValue1.concat("" , pinValue2);
var String_4 = String_3.concat("" ,  pinValue3);
var String_5 = String_4.concat("" ,  pinValue4);

fetch("http://www.aonde.biz/mobile/doLogin.php", {
  method: "POST",
  headers: {
    Accept: "application/json",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "pin":212,

  })
})
  .then(response => response.json())
  .then(responseJson => {
    // Showing response message coming from server after inserting records.
    Alert.alert(responseJson);
  })
  .catch(error => {
    console.error(error);
  });

In the above code when I pass pin parameter API then show this error. Thank youin image show full erro please give some idea how to resolve this issue.

React Native Making Changes and Updates After Publishing iOS App for TestFlight

$
0
0

Finally, I got my app uploaded to Testflight! This is a big stepping stone for me, however, what happens when you need to make a change? Is there a process that you need to do? I built my app again on XCode. Does it automatically update on the users' phones?


Open multiple phone numbers with expo linking module react native

$
0
0

I'm a bit new to react native, so I've been using expo to develop my first app. The expo linking module is really nice (how it pulls up a phone number on the bottom of the screen for iOS), but I was wondering if you can pull up multiple phone numbers, and if so, how you could do that (and if you can format it at all). For example, the user would click a button and multiple options (maybe of the format "${name}: ${phoneNumber}") would appear at the bottom of the screen so that the user could then select one to call, rather than it only pulling up one phone number. I know another option to get a similar effect would be to use Alert, and format each of the buttons, which would then pull up the single link phone number, but I feel like having multiple phone numbers listed without having to go through an alert might be a bit more pleasing for the user. Does anyone familiar with the expo packages know if it's possible to open up multiple phone numbers with the linking module, and if so, how to (if you can) format them?

How to display mathematical formula in React Native?

$
0
0

I'm planning to build an APP which helps the less developed area share the same learning resources.

Displaying mathematical formula is a key feature of this APP. Is there any opensource components which allows the app displaying the formula in React Native?

react-native: Get error, invariant violation: View config not found of RNSVGCircle

$
0
0

Ok so basically Im importing many libraries to a project all at once, and trying them out one by one. Right now Im trying to make SVG work (Google Sign In and Gesture Handler work accordingly), but after running this code:

**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * @format
 * @flow
 */

import React, { useState } from 'react';
import {
  SafeAreaView,
  StyleSheet,
  ScrollView,
  View,
  StatusBar,
  Text,
} from 'react-native';

import Svg, { Circle } from 'react-native-svg';

import {
  TapGestureHandler,
  LongPressGestureHandler,
  State
} from 'react-native-gesture-handler'

import OneSignal from 'react-native-onesignal'

import {
  GoogleSignin,
  GoogleSigninButton,
  statusCodes,
} from '@react-native-community/google-signin';
//aa

import RNlocalize from 'react-native-localize'

import YouTube from 'react-native-youtube';

//import Share from 'react-native-share';

const App: () => React$Node = () => {

  const [text, setText] = useState('Yass')

  const _handleStateChange = ({ nativeEvent }) => {
    if (nativeEvent.state === State.ACTIVE) {
      setText('Long Press')
    }
    if (nativeEvent.state === State.END) {
      setText('Back to Yass')
    }
  }

  return (
    <View>
      <View style={{ padding: 80 }}>
        <GoogleSigninButton //a
          style={{ width: 192, height: 48 }}
          size={GoogleSigninButton.Size.Wide}
          color={GoogleSigninButton.Color.Dark}
        />
        <Text>HOLAaApessssnesdsdA</Text>
        <LongPressGestureHandler onHandlerStateChange={_handleStateChange}>
          <Text style={styles.buttonText}>Longpress me</Text>
        </LongPressGestureHandler>
        <Text>{text}</Text>
      </View>
      <View>
        <Svg height="100" width="100">
          <Circle cx="50" cy="50" r="50" fill="pink" />
        </Svg>
      </View>
    </View>

  );//a
};

const styles = StyleSheet.create({

  buttonText: {
    borderWidth: 1,
  }
});

export default App;

The following error jumps

ExceptionsManager.js:44 Invariant Violation: requireNativeComponent: "RNSVGCircle" was not found in the UIManager.

This error is located at:
    in RNSVGCircle (at Circle.tsx:24)
    in Circle (at App.js:71)
    in RNSVGGroup (at G.tsx:28)
    in G (at Svg.tsx:170)
    in RNSVGSvgView (at Svg.tsx:157)
    in Svg (at App.js:70)
    in RCTView (at App.js:69)
    in RCTView (at App.js:56)
    in App (at renderApplication.js:40)
    in RCTView (at AppContainer.js:101)
    in RCTView (at AppContainer.js:119)
    in AppContainer (at renderApplication.js:39)

Tried readding the library to the project, reinstalling and even manually adding the RNSVG podspec to my podfile. Im out of ideas right now.

ps: Im new on React Native and could be just a big dumb mistake on my part, so bear with me and thanks in advance

How to get initial link for iOS using react native firebase dynamic links?

$
0
0

I am using react-native-firebase:: 5.6.0, I am having issue while getting initial link for iOS device. On android it's working fine. I am using "Firebase Dynamic Links" to redirect user inside login screen of my app if in case he is not logged in inside app, otherwise just opening app if he is already logged in. It's working for android app but having an issue with ios app. I have used two function one is the get dynamic link if app is closed "getInitialLink" and another one is to check when app is opened "onLink".

This is function I am using after closing splash screen, only called once when opening app from closing state.

firebase.links().getInitialLink().then((url) => {
    if (url && url === 'https://mycustomdomain.co.in') {
        navigationToScreen(AUTH, INITIAL_SCREEN);
    } else {
        // INITIALIZE APP HERE
    }
});

If app already opened I am getting dynamic link url value inside this function::

this.unsubscribeHandleOpenAppDynamicLinks = firebase.links().onLink(async (url) => {
    let isLoggedIn = await AsyncStorage.getItem(LocalStorageKeys.IS_LOGGEDIN);
    if (url) {
        if ( isLoggedIn !== 'yes'&& url === 'https://mycustomdomain.co.in') {
            navigationToScreen(AUTH, INITIAL_SCREEN);
        }
    }
});


and clearing that listener on componentWillUnmount:: this.unsubscribeHandleOpenAppDynamicLinks();

In case of iOS only "onLink" function is working and I am getting url value as "undefined". getInitialLink() function will returns the URL that the app has been launched from. If the app was not launched from a URL the return value will be null, but I am getting "undefined" even when launching an app from url in case of iOS only. I am getting url inside onLink() in case of iOS when app is launched. Why this is happening??

Please suggest what I am doing wrong here.

Putting buttons over a full screen video in React Native

$
0
0

I am playing a video that takes up the entire screen (full height, and width of the device).I would also like to display a couple of buttons and the videos description (Kind of like TikTok does).

What would be the best way to add text and buttons over the Video? I am currently playing around the position and bottom attributes but I noticed that it does not look look good on all sizes as the bottom value doesn't work for every screen size.

This is what I currently have:

<View style={{flex: 1, height: height, width: width, backgroundColor: colors.BLACK}}>
                    <VideoPlayer
                        style={StyleSheet.absoluteFill}
                        paused={index !== this.state.currentVisibleIndex}
                        source={{uri: item.mediaUri}}
                        repeat={true}
                        disableFullscreen
                        disableVolume
                        onBack={() => this.props.navigation.goBack()}
                    />
                </View>

                <View style={{position: 'absolute', bottom: 125, justifyContent: 'flex-start', alignItems: 'flex-start'}}>
                    <Text style={styles.username_text}>@{item.username}</Text>
                    <Text style={styles.description_text}>{item.description}</Text>
                </View>

Viewing all 16555 articles
Browse latest View live


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