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

Headers are not being sent in iOS but working in android for Axios React Native

$
0
0

I'm using Axios for sending http requests, it's working fine for Android, but the headers are not sent in iOS, here is my code:

Axios.get('/patient/doctor/search?page_size=10&page=1')
        .then(function (response) {
          // handle response
        })
        .catch(function (error) {
            // here it goes with 401 error code
        });

and in my interceptor:

Axios.interceptors.request.use(async config => {
try {
    const user = await AsyncStorage.getItem('user');
    const userData = JSON.parse(user);
    if (userData.token) {
        config.headers = {
            ContentType: 'application/json',
            Authorization: 'Bearer [JWT-TOKEN]'
        }
    } else {
        config.headers = {
            ContentType: 'application/json'
        };
    }
} catch (e) {
    config.headers = { 'ContentType': 'application/json; charset=utf' };
}
return config;
}, error => {
    return Promise.reject(error);
});

Any Idea ?


FlatList onEndReached being called multiple times

$
0
0

I'm making a react native project where user can search images using Flickr API, Everything else is working fine but the problem i'm having while implementing pagination. I have used FlatList's onEndReached to detect when user has scrolled to the end on the list, but the problem is onEndReached is being called multiple times(including one during the first render). I have even disabled bounce as said here but it's still being called more than once

 export default class BrowserHome extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      isLoading: false,
      tagParam: "cat",
      pageNum: -1,
      data: [],
      photosObj: ""
    };
  }

  componentDidMount() {
    this.setState({
      isLoading: true
    });
    try {
      this.makeRequest();
    } catch {
      console.log("error has occurred");
    }
  }

  makeRequest = () => {
    const { tagParam, pageNum } = this.state;
    let url = `https://api.flickr.com/services/rest/? 
               method=flickr.photos.search
               &api_key=${apiKey}&format=json&tags=${tagParam}
               &per_page=30&page=${pageNum + 1}&nojsoncallback=1`;
    fetch(url, {
      method: "GET"
    })
      .then(response => response.json())
      .then(responseJSON => {
        this.setState({
          data: this.state.data.concat(responseJSON.photos.photo),
          isLoading: false,
          pageNum: responseJSON.photos.page
        });
      })
      .catch(error => {
        console.log(error);
        this.setState({ isLoading: false });
        throw error;
      });
  };

  render() {
    if (this.state.isLoading) {
      return <ActivityIndicator animating={true} size="large" />;
    }

    return (
      <View
        style={{
          flex: 1,
          height: 200,
          justifyContent: "flex-start",
          width: screenSize.width,
          backgroundColor: "black"
        }}
      >
        <Text>This is browserhome</Text>
        <FlatList
          style={{
            width: screenSize.width
          }}
          numColumns={3}
          data={this.state.data}
          keyExtractor={item => item.id}
          bounces={false}
          onEndReachedThreshold={1}
          onEndReached={({ distanceFromEnd }) => {
            this.loadMoreItem();
            alert("end reached call");
          }}
          renderItem={({ item, index }) => (
            <>
              <ImageTile imageURL={this.createImageURL(item)} />
            //  <Text style={{ color: "white" }}>
             //   {index}
             //   {console.log(index)}
             // </Text>
            </>
          )}
        />
      </View>
    );
  }

  createImageURL(item) {
    let server = item.server,
      id = item.id,
      secret = item.secret;
    let urlString = `https://farm${
      item.farm
    }.staticflickr.com/${server}/${id}_${secret}_s.jpg`;
    return urlString;
  }

  loadMoreItem() {
    this.makeRequest();
  }
}

React Native IOS "CRAWKWebView"

$
0
0

How can I fix I get "CRAWKWebView" error when I build iOS in my React Native application.?

Invariant vilation: requireNativeComponent: "CRAWKWebView" was not found in the UIManager

Screen SHOT :

IOS Screenshot

https://ibb.co/tzx3PB3

How to use a EXPO iOS StoreReview API?

$
0
0

I tried to add a EXPO iOS StoreReview API but failed. have any sample code?

import * as StoreReview from 'expo-store-review';
...
export default SettingPage() {
  handleReview = () => {
    if (StoreReview.isSupported()) {
      StoreReview.requestReview();
    }
  };

  render (
    ...
    <TouchableOpacity onPress={handleReview}>
      <Text>Click Review</Text>
    </TouchableOpacity>
  );
}

react-native-ble-manager return device name null

$
0
0

I'm using react-native-ble-manager for scan and show all devices. It's working fine, but it's not showing the name of devices (just the MAC id). Here's my code:

import React, { Component } from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    View,
    TouchableHighlight,
    NativeAppEventEmitter,
    NativeEventEmitter,
    NativeModules,
    Platform,
    PermissionsAndroid,
    ScrollView,
    AppState,
    FlatList,
    Dimensions,
} from 'react-native';
import BleManager from 'react-native-ble-manager';
import { stringToBytes } from 'convert-string';

const window = Dimensions.get('window');

const BleManagerModule = NativeModules.BleManager;
const bleManagerEmitter = new NativeEventEmitter(BleManagerModule);


export default class App extends Component {

    constructor() {
        super();

        this.state = {
            scanning:false,
            peripherals: new Map(),
            appState: ''
        };

        this.handleDiscoverPeripheral = this.handleDiscoverPeripheral.bind(this);
        this.handleStopScan = this.handleStopScan.bind(this);
        this.handleUpdateValueForCharacteristic = this.handleUpdateValueForCharacteristic.bind(this);
        this.handleDisconnectedPeripheral = this.handleDisconnectedPeripheral.bind(this);
        this.handleAppStateChange = this.handleAppStateChange.bind(this);
    }

    componentDidMount() {
        AppState.addEventListener('change', this.handleAppStateChange);

        BleManager.start({showAlert: false});

        this.handlerDiscover = bleManagerEmitter.addListener('BleManagerDiscoverPeripheral', this.handleDiscoverPeripheral );
        this.handlerStop = bleManagerEmitter.addListener('BleManagerStopScan', this.handleStopScan );
        this.handlerDisconnect = bleManagerEmitter.addListener('BleManagerDisconnectPeripheral', this.handleDisconnectedPeripheral );
        this.handlerUpdate = bleManagerEmitter.addListener('BleManagerDidUpdateValueForCharacteristic', this.handleUpdateValueForCharacteristic );



        if (Platform.OS === 'android'&& Platform.Version >= 23) {
            PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION).then((result) => {
                if (result) {
                    console.log("Permission is OK");
                } else {
                    PermissionsAndroid.requestPermission(PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION).then((result) => {
                        if (result) {
                            console.log("User accept");
                        } else {
                            console.log("User refuse");
                        }
                    });
                }
            });
        }

    }

    handleAppStateChange(nextAppState) {
        if (this.state.appState.match(/inactive|background/) && nextAppState === 'active') {
            console.log('App has come to the foreground!');
            BleManager.getConnectedPeripherals([]).then((peripheralsArray) => {
                console.log('Connected peripherals: ' + peripheralsArray.length);
            });
        }
        this.setState({appState: nextAppState});
    }

    componentWillUnmount() {
        this.handlerDiscover.remove();
        this.handlerStop.remove();
        this.handlerDisconnect.remove();
        this.handlerUpdate.remove();
    }

    handleDisconnectedPeripheral(data) {
        let peripherals = this.state.peripherals;
        let peripheral = peripherals.get(data.peripheral);
        if (peripheral) {
            peripheral.connected = false;
            peripherals.set(peripheral.id, peripheral);
            this.setState({peripherals});
        }
        console.log('Disconnected from ' + data.peripheral);
    }

    handleUpdateValueForCharacteristic(data) {
        console.log('Received data from ' + data.peripheral + ' characteristic ' + data.characteristic, data.value);
    }

    handleStopScan() {
        console.log('Scan is stopped');
        this.setState({ scanning: false });
    }

    startScan() {
        if (!this.state.scanning) {
            //this.setState({peripherals: new Map()});
            BleManager.scan([], 3, true).then((results) => {
                console.log(JSON.stringify(results));
                console.log('Scanning...');
                this.setState({scanning:true});
            });
        }
    }

    retrieveConnected(){
        BleManager.getConnectedPeripherals([]).then((results) => {
            if (results.length === 0) {
                console.log('No connected peripherals')
            }
            console.log(results);
            var peripherals = this.state.peripherals;
            for (var i = 0; i < results.length; i++) {
                var peripheral = results[i];
                peripheral.connected = true;
                peripherals.set(peripheral.id, peripheral);
                this.setState({ peripherals });
            }
        });
    }

    handleDiscoverPeripheral(peripheral){
        var peripherals = this.state.peripherals;
        console.log('Got ble peripheral', JSON.stringify(peripheral));
        console.log('NAME: ' + peripheral.name);
        if (peripheral.name === null) {
            peripheral.name = 'NO NAME';
        }
        peripherals.set(peripheral.id, peripheral);
        this.setState({ peripherals });
    }

    renderItem(item) {
        const color = item.connected ? 'green' : '#fff';
        return (
            <TouchableHighlight onPress={() => this.sendData(item.id, 'ola') }>
                <View style={[styles.row, {backgroundColor: color}]}>
                    <Text style={{fontSize: 12, textAlign: 'center', color: '#333333', padding: 10}}>{item.name}</Text>
                    <Text style={{fontSize: 10, textAlign: 'center', color: '#333333', padding: 2}}>RSSI: {item.rssi}</Text>
                    <Text style={{fontSize: 8, textAlign: 'center', color: '#333333', padding: 2, paddingBottom: 20}}>{item.id}</Text>
                </View>
            </TouchableHighlight>
        );
    }

    render() {
        const list = Array.from(this.state.peripherals.values());

        return (
            <View style={styles.container}>
                <TouchableHighlight style={{marginTop: 40,margin: 20, padding:20, backgroundColor:'#ccc'}} onPress={() => this.startScan() }>
                    <Text>Scan Bluetooth ({this.state.scanning ? 'on' : 'off'})</Text>
                </TouchableHighlight>
                <TouchableHighlight style={{marginTop: 0,margin: 20, padding:20, backgroundColor:'#ccc'}} onPress={() => this.retrieveConnected() }>
                    <Text>Retrieve connected peripherals</Text>
                </TouchableHighlight>
                <ScrollView style={styles.scroll}>
                    {(list.length === 0) &&
                    <View style={{flex:1, margin: 20}}>
                        <Text style={{textAlign: 'center'}}>No peripherals</Text>
                    </View>
                    }
                    <FlatList
                        data={list}
                        renderItem={({ item }) => this.renderItem(item) }
                        keyExtractor={item => item.id}
                    />

                </ScrollView>
            </View>
        );
    }
}

React Native: Determine number of lines of Text component

$
0
0

As the title says, I've been trying to find a way to determine the number of lines the text component AFTER it has been given text. Look at my example below.

<Text>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi semper ut ipsum in ultrices. Vivamus fringilla lacinia odio in accumsan. Proin sit amet pellentesque tortor. Nam mollis sit amet ligula id convallis. Etiam in semper diam. Cras id elit consectetur, interdum ante id, tincidunt nisi. Integer non elit placerat, dignissim nibh at, faucibus sem. Curabitur nec posuere turpis. Vivamus rhoncus nulla vitae mi imperdiet, elementum eleifend mi laoreet. Vestibulum molestie turpis non nibh elementum, sed ornare magna tristique. Aliquam erat volutpat. Phasellus volutpat mi vel tempor finibus.
</Text>

At runtime, how can I determine how many lines this Text component has rendered. This number will vary depending on device (eg. iPhone 5 will need to render more lines vs iPhone 6+ as it has a smaller screen size). I've checked the source code for the Text component but there doesn't seem to be anything I'm looking for.

I am using React Native 0.24.

Any ideas?

Cheers.

React-Native: React could not be found within project or in these directories

$
0
0

We have upgraded our react native project to the latest react native version (v0.61.2) with react (16.9.0) and it works perfectly fine on android. When we try to run it on ios thought, we get the message:

warning: the transform cache was reset. Loading dependency graph, done. error: bundling failed: Error: Unable to resolve module `React` from `ios/Pods/React/Libraries/react-native/react-native.js`: React could not be found within the project or in these directories:   node_modules

If you are sure the module exists, try these steps:
 1. Clear watchman watches: watchman watch-del-all
 2. Delete node_modules: rm -rf node_modules and run yarn install
 3. Reset Metro's cache: yarn start --reset-cache
 4. Remove the cache: rm -rf /tmp/metro-*

We have followed the upgrade guide, updated all dependencies to their latest version and updated the pods. I actually don't know where or how to start debugging this, since this seems to be coming from the Pods folder.

This is the content of our Pods folder:

ls ios/Pods/
Adjust              GoogleDataTransport
Crashlytics         GoogleDataTransportCCTSupport
DoubleConversion        GoogleUtilities
Fabric              Headers
Firebase            Local Podspecs
FirebaseABTesting       Manifest.lock
FirebaseAnalytics       Pods.xcodeproj
FirebaseAnalyticsInterop    Protobuf
FirebaseCore            Pushwoosh
FirebaseCoreDiagnostics     PushwooshInboxUI
FirebaseCoreDiagnosticsInterop  React
FirebaseDynamicLinks        Target Support Files
FirebaseInstanceID      boost-for-react-native
FirebaseRemoteConfig        glog
Folly               nanopb
GoogleAppMeasurement

and in our node_modules folder, we have (with a lot more other packages):

...
react
depd                        react-deep-force-update
des.js                      react-devtools-core
destroy                     react-is
detect-libc                 react-lifecycles-compat
detect-newline              react-native
...

I have, of course, tried all the steps, like clearing caches, reset-cache, clearing DerivedData, Clean and build, ... I don't know where to start looking.

Previous Ad-Hoc build on iOS crashes on start

$
0
0

I'm currently distributing a react-native detached expo app for iOS via ad-hoc distribution, and I have a paid developer account. The build can be downloaded and installed just fine, but I've noticed an issue after I update the distribution profile to include additional users. I released a new build that didn't include any changes, but I refreshed the ad hoc profile in XCode prior to building to include the new users. Now after a week, a user that was using an older build could no longer open the app even though they were included in the distribution profile. From my understanding, the certificate should still work from the previous build.

I had the user reinstall the app with the latest build and now everything is working fine.

Am I missing something here? It seems like the previous version of the distribution profile is expiring.


React-native: Project through error after update Catalina

$
0
0

I am facing issue in run the project after updating Mac OS version high sierra to Catalina

run command react-native init pod install in ios directory then run ios code using xcode(10.0)

"react": "16.9.0"
"react-native": "0.61.3"

run ios code using xcode then ERROR is:-

error: error reading '../node_modules/react-native/ReactCommon/jsinspector/InspectorInterfaces.cpp'

failed to load podspec - invalid podspec file syntax error, unexpected ']' - Unknown command: `xxx` Did you mean: deintegrate?

$
0
0

I don't know how this happened but I suddenly started getting this error about multiple podspec files (DoubleConversion, Folly, glog) when I try to pod update:

Commandline output:

Updating local specs repositories

Analyzing dependencies

Fetching podspec for DoubleConversion from ../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec

[!] Failed to load 'DoubleConversion' podspec:

[!] Invalid DoubleConversion.podspec file: syntax error, unexpected ']'.

from /Users/me/ReactNativeProjects/myProject/node_modules/react-native/third-party-podspecs/DoubleConversion.podspec:1

----------

[!] Unknown command: DoubleConversion,
Did you mean: deintegrate?

----------

Podfiles somehow seem to be corrupted (content replaced) and seemingly all have the same content. Content of DoubleConversion podspec file is below:

[!] Unknown command: DoubleConversion,

Did you mean: deintegrate?

Usage:

$ pod COMMAND

  CocoaPods, the Cocoa library package manager.

Commands:

+ cache         Manipulate the CocoaPods cache
+ deintegrate   Deintegrate CocoaPods from your project
+ env           Display pod environment
+ init          Generate a Podfile for the current directory
+ install       Install project dependencies according to versions from a
                Podfile.lock
+ ipc           Inter-process communication
+ lib           Develop pods
+ list          List pods
+ outdated      Show outdated project dependencies
+ plugins       Show available CocoaPods plugins
+ repo          Manage spec-repositories
+ search        Search for pods
+ setup         Setup the CocoaPods environment
+ spec          Manage pod specs
+ trunk         Interact with the CocoaPods API (e.g. publishing new specs)
+ try           Try a Pod!
+ update        Update outdated project dependencies and create new Podfile.lock

Options:

--silent        Show nothing
--version       Show the version of the tool
--verbose       Show more debugging information
--no-ansi       Show output without ANSI codes
--help          Show help banner of specified command

Any idea of how this happened and how to fix them? (cocoapods-1.8.4)

p.s. I did fix the problem just by visiting the related GitHub pages and copying the corresponding podspec contents from there. I just can't understand why/how this happened.

How to integrate native ios camera SDK in existing react native App?

$
0
0

I am currently working with a react native app as per requirement i need to integrate external camera with ios and android SDK.

As react native SDK for particular camera is not available can anyone help me with any example how I can complete this task using iOS And Android SDK.

Camera should capture multiple images and video also so that I can post those with button press.

Thanks..!!

can't change background color of a button that's imported from react-native-paper

$
0
0

i am new to react native following a tutorial. I noticed there is no consistency of buttons between android and iOS so i thought i'd try react-native-paper library.

however, after importing the button from react-native-paper i am having problems changing the color of the button. the color is a constant color as in the image provided how the color looks

how can i manipulate the color? also is there a better library to use for button consistency between android and iOS ?

thanks

here is the code :

// import stuff
import React from 'react';
import { View, Text, TextInput, TouchableOpacity } from 'react-native';
import {
  Provider as PaperProvider,
  DarkTheme,
  DefaultTheme,
  Button
} from 'react-native-paper';
// import { Button } from 'react-native-paper';

//create stuff

class App extends React.Component {

  state = {
    text: "",
    todo: []
  }
  addTodo = () => {
    var newTodo = this.state.text
    var arr = this.state.todo
    arr.push(newTodo)
    this.setState({ todo: arr, text: "" })
  }

  deleteTodo = (t) => {
    var arr = this.state.todo;
    var pos = arr.indexOf(t);
    arr.splice(pos, 1);
    this.setState({ todo: arr });


  }

  renderTodos = () => {
    return this.state.todo.map(t => {
      return (
        <TouchableOpacity key={t}>
          <Text
            style={styles.todo}
            onPress={() => { this.deleteTodo(t) }}
          >{t}</Text>
        </TouchableOpacity>
      )
    })
  } 
  render() {
    return (
      <PaperProvider>
      <View style={styles.wholeStyle}>
        <View style={styles.viewStyle}>
          <Text style={styles.header}>Notes App</Text>
          <TextInput
            style={styles.inputStyle}
            onChangeText={(text) => this.setState({ text })}
            value={this.state.text}
          />
          <Button 
          onPress={this.addTodo}
          mode='contained'
          backgroundColor='black'>Todo</Button>
          {this.renderTodos()}
        </View>
      </View>
      </PaperProvider>
    )
  }
}

const styles = {
  wholeStyle: {
    flex: 1,
    backgroundColor: '#0288D1'
    // backgroundColor: 'red'
  },
  viewStyle: {
    alignItems: 'center',
    justifyContent: 'center',
    margin: 10,
    marginTop: 30,

  },
  inputStyle: {
    alignSelf: 'stretch',
    height: 40,
    borderColor: "white",
    borderWidth: 1

  },
  header: {
    fontSize: 40,
    color: 'white',
    fontWeight: 'bold'

  },
  todo: {
    fontSize: 18,
    color: 'white'
  }


}
//export stuff

export default App;

Detox Testing with Expo - Cannot connect to Emulator

$
0
0

I'm currently building a proof-of-concept to see if we can use Detox for end-to-end testing a React Native app that's built using Expo.

I've followed the instructions here, but the tests are timing out. When I run the test in trace mode, I get the following error:

detox[11493] WARN:  [Client.js/PENDING_REQUESTS] App has not responded to the network requests below:
  (id = 2) invoke: {"target":{"type":"Invocation","value":{"target":{"type":"EarlGrey","value":"instance"},"method":"det
ox_selectElementWithMatcher:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYMatchers"},"method":"matcherForAccessibilityID:","args":[{"type":"NSString","value":"vwGatedBackground"}]}}]}},"method":"assertWithMatcher:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYMatchers"},"method":"matcherForSufficientlyVisible","args":[]}}]}
  (id = -1000) isReady: {}

That might be the reason why the test "Example should have welcome screen" has timed out.

Has anyone had any experience with getting this set-up running? I'm testing just for iOS and using the XCode iOS emulator.

As far as I can read, this is a community-supported integration rather being something offered officially by Detox, so it's possible that this just doesn't work, but I thought I'd check to see if anyone's had any luck with getting this set-up running?

Why IOS on react native duplicates my cookie?

$
0
0

I do a POST request with axios and I set a Cookie in the headers. In Android it works fine but in iOS the server's logs show me that the cookie has been duplicated by iOS. I have set an interceptor in my js code that shows that the error is not from my code.

Thanks.

getUserMedia iOS, better to have app instead of browser solution [closed]

$
0
0

Created a site where I needed user to use their microphone and in realtime I display the waveform with different visualizations. This seemed to work on desktop browsers but did not work consistently on iOS. I later discovered issues with getUserMedia and the lack of support and documentation for it from Apple. At this point I am wondering if the only way to get around this issue is by creating an app ? Is it more likely that getting the audio data from client's microphone is possible via an app in iOS and Android ? If so, should I use Flutter or ReactNative ? Any advice would be helpful.


Expo app 'Your app is using the Advertising Identifier (IDFA)'

$
0
0

I am trying to upload an app to the App Store and every time I upload a binary Apple insists that my app is using ads when I have never implemented such a thing. I reviewed the docs and removed all code involving ASIdentifier and adIdentifier I'm not quite sure what I'm missing. What can I do to resolve this issue?

How to hide the text selection handles from TextInput in React Native?

$
0
0

I have a TextInput in React Native with property selectTextOnFocus={true}, it highlights the text on first touch and show the context menu on second touch which is correct.

What I want is hide the left and right selection handles but keep the text highlighted on the first touch on iOS (it's ok on Android)

This is my input first touch: First touch

This is Safari browse box first touch: Safari

Unable to Archive on Xcode 11 using realm

$
0
0

Unable to Archive using Xcode 11.1

Able to build an archive on Xcode 10.3 but archive not generating on Xcode 11

Steps:-

1.) Install latest or old 'realm'

2.) Link the realm using - react-native link realm

3.) Start generating and archive.

4.) Fails to generate archive

Error :-

GCDWebServers target :-

  1. /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.1.sdk/System/Library/Frameworks/Security.framework/Headers/SecProtocolTypes.h:187:18: Unknown type name 'SecTrustRef'

  2. /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLCredential.h:9:9: Could not build module 'Security'

  3. /Users/impadmin/Documents/Projects/ReactNativeProjects/MainBoilerPlate/node_modules/realm/vendor/GCDWebServer/GCDWebServer/Core/GCDWebServerHTTPStatusCodes.h:31:9: Could not build module 'Foundation'

Version:-

react-native: "0.61.1"

realm: "3.3.0"

xcode:11.1

ios:13

Archive Failure error

Duplication of notification when app is open

$
0
0

React Native duplication of notification when app is open

async componentWillMount() {
    // herhangi bir bildirim etkileşiminde çalışır
    FCM.on(FCMEvent.Notification, notif => {
        console.log("Bildirim geldi", notif);

        if(Platform.OS ==='ios'&& notif._notificationType === NotificationType.WillPresent && !notif.local_notification){              
            notif.finish(WillPresentNotificationResult.All)
            return;
        }

    });

    // eğer token yenilenirse çalışır
    FCM.on(FCMEvent.RefreshToken, token => {
        console.log("TOKEN YENİLENDİ (refreshUnsubscribe)", token);
    });

    // Uygulamaya Push atmak için izin alıyoruz
    try {
        let result = await FCM.requestPermissions({badge: false, sound: true, alert: true});
    } catch(e){
        console.error(e);
    }

    // Firebase Cloud Message Token değerini getirir.
    FCM.getFCMToken().then(token => {
        console.log("TOKEN (getFCMToken)", token);
    });

    if(Platform.OS === 'ios') {
        // Eğer APNS istiyorsanız isteğe bağlı APNS TOKEN
        FCM.getAPNSToken().then(token => {
            console.log("APNS TOKEN (getAPNSToken)", token);
        });
    }
}

and my local notification part

 FCM.scheduleLocalNotification({
                  id: "testnotif2",
                  fire_date:  date_ara1.getTime(),
                  vibrate: 500,
                  title: "Unutmayınız!",
                  body: "Ara Öğünü Saati",
                  sub_text: "sub text",
                  priority: "high",             
                  show_in_foreground: true,
                  wake_screen: true,
                  extra1: { a: 1 },
                  extra2: 1,
                  repeat_interval:'day'
                });

i commented this part like https://github.com/evollu/react-native-fcm/issues/442#issuecomment-334154351 this comment but it's not working.

if(Platform.OS ==='ios'&& notif._notificationType === NotificationType.WillPresent && !notif.local_notification){              
            notif.finish(WillPresentNotificationResult.All)
            return;
        }

working with react-native, How can we execute javascript function at native level in IOS? [closed]

$
0
0

Question: Hi ! I want to execute a Javascript function at native level in IOS. I achieved the same in android by exposing the javascript function to the Java and then used that function in android by using react Instance manager, reactnative host, reactcontext and catalyst instance. I tried to research for a way I could achieve the same in IOS. Any, link or guidance will be helpful.

Viewing all 16568 articles
Browse latest View live


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