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

React native app giving blank screen when rendering two RNCamera components

$
0
0

I am trying to use two RNCamera components in a screen, so that each component takes half of the screen and I can show back and front camera at the same time.

But unfortunately, the app is giving just a blank screen as soon as I add the second RNCamera component. Can someone help me with this.

Below is my code.

<View style={styles.container}>
        <View style={{ flex: 1 }}>
          <RNCamera
            ref={ref => {
              this.camera1 = ref;
            }}
            style={styles.preview}
            type={RNCamera.Constants.Type.back}
            flashMode={RNCamera.Constants.FlashMode.off}
            androidCameraPermissionOptions={{
              title: 'Permission to use camera',
              message: 'We need your permission to use your camera',
              buttonPositive: 'Ok',
              buttonNegative: 'Cancel',
            }}
            androidRecordAudioPermissionOptions={{
              title: 'Permission to use audio recording',
              message: 'We need your permission to use your audio',
              buttonPositive: 'Ok',
              buttonNegative: 'Cancel',
            }}
            onGoogleVisionBarcodesDetected={({ barcodes }) => {
              console.log(barcodes);
            }}
          />
        </View>
        <View style={{ flex: 1 }}>
          <RNCamera
            ref={ref => {
              this.camera2 = ref;
            }}
            style={styles.preview}
            type={RNCamera.Constants.Type.back}
            flashMode={RNCamera.Constants.FlashMode.off}
            androidCameraPermissionOptions={{
              title: 'Permission to use camera',
              message: 'We need your permission to use your camera',
              buttonPositive: 'Ok',
              buttonNegative: 'Cancel',
            }}
            androidRecordAudioPermissionOptions={{
              title: 'Permission to use audio recording',
              message: 'We need your permission to use your audio',
              buttonPositive: 'Ok',
              buttonNegative: 'Cancel',
            }}
            onGoogleVisionBarcodesDetected={({ barcodes }) => {
              console.log(barcodes);
            }}
          />
        </View>
        <View style={{ flex: 1, flexDirection: 'row', backgroundColor: 'yellow', justifyContent: 'center' }}>
          <TouchableOpacity onPress={this.takePicture.bind(this)} style={styles.capture}>
            <Text style={{ fontSize: 14 }}> SNAP </Text>
          </TouchableOpacity>
        </View>


I want to loop through my list in tinder like UI

$
0
0

So i'm relatively new to react native and mobile dev,
so in my app i'm trying the tinder swiping UI ( left and right swipe ) following a tutorial on youtube, the thing is i want to loop through my list of data>>>

 `const Jobs = [
  { id: "1", uri: require("../assets/images/cards/webDev.jpg") },
  { id: "2", uri: require("../assets/images/cards/communication2.jpg") },
  { id: "3", uri: require("../assets/images/cards/graphicDesign.jpg") }
];` 


after swiping the final card ( id: "3" ) over and over again, but i can't seem to find a way to do that, if anyone could help it would be appreciated here's my code :

import * as WebBrowser from "expo-web-browser";
import React, { Component } from "react";
import {
  Image,
  Platform,
  ScrollView,
  StyleSheet,
  Text,
  TouchableOpacity,
  View,
  PanResponder,
  Animated,
  SafeAreaView,
  Dimensions
} from "react-native";

import { Card } from "react-native-elements";
import { MonoText } from "../components/StyledText";
import Project from "../components/Project";
import Project2 from "../components/Project";

import Swipe from "../components/Swipe";
//import jobs from "../constants/homeData";
const SCREEN_HEIGHT = Dimensions.get("window").height;

const SCREEN_WIDTH = Dimensions.get("window").width;
const Jobs = [
  { id: "1", uri: require("../assets/images/cards/webDev.jpg") },
  { id: "2", uri: require("../assets/images/cards/communication2.jpg") },
  { id: "3", uri: require("../assets/images/cards/graphicDesign.jpg") }
];
export default class HomeScreen extends Component {
  constructor() {
    super();

    this.position = new Animated.ValueXY();
    this.state = {
      currentIndex: 0
    };

    this.rotate = this.position.x.interpolate({
      inputRange: [-SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2],
      outputRange: ["-10deg", "0deg", "10deg"],
      extrapolate: "clamp"
    });

    this.rotateAndTranslate = {
      transform: [
        {
          rotate: this.rotate
        },
        ...this.position.getTranslateTransform()
      ]
    };

    this.likeOpacity = this.position.x.interpolate({
      inputRange: [-SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2],
      outputRange: [0, 0, 1],
      extrapolate: "clamp"
    });

    this.dislikeOpacity = this.position.x.interpolate({
      inputRange: [-SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2],
      outputRange: [1, 0, 0],
      extrapolate: "clamp"
    });

    this.nextCardOpacity = this.position.x.interpolate({
      inputRange: [-SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2],
      outputRange: [1, 0.8, 1],
      extrapolate: "clamp"
    });

    this.nextCardScale = this.position.x.interpolate({
      inputRange: [-SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2],
      outputRange: [1, 0, 1],
      extrapolate: "clamp"
    });
  }
  componentWillMount() {
    this.PanResponder = PanResponder.create({
      onStartShouldSetPanResponder: (evt, gestureState) => true,
      onPanResponderMove: (evt, gestureState) => {
        this.position.setValue({ x: gestureState.dx, y: gestureState.dy });
      },
      onPanResponderRelease: (evt, gestureState) => {
        if (gestureState.dx > 180) {
          Animated.spring(this.position, {
            toValue: { x: SCREEN_WIDTH + 100, y: gestureState.dy }
          }).start(() => {
            this.setState({ currentIndex: this.state.currentIndex + 1 }, () => {
              this.position.setValue({ x: 0, y: 0 });
            });
          });
        } else if (gestureState.dx < -180) {
          Animated.spring(this.position, {
            toValue: { x: -SCREEN_WIDTH - 100, y: gestureState.dy }
          }).start(() => {
            this.setState({ currentIndex: this.state.currentIndex + 1 }, () => {
              this.position.setValue({ x: 0, y: 0 });
            });
          });
        } else {
          Animated.spring(this.position, {
            toValue: { x: 0, y: 0 },
            friction: 4
          }).start();
        }
      }
    });
  }

  renderJobs = () => {
    return Jobs.map((item, i) => {
      if (i < this.state.currentIndex) {
        return null;
      } else if (i == this.state.currentIndex) {
        return (
          <Animated.View
            {...this.PanResponder.panHandlers}
            key={item.id}
            style={[
              this.rotateAndTranslate,
              {
                height: SCREEN_HEIGHT - 180,
                width: SCREEN_WIDTH,
                padding: 10,
                position: "absolute"
              }
            ]}
          >
            <Animated.View
              style={{
                opacity: this.likeOpacity,
                transform: [{ rotate: "-30deg" }],
                position: "absolute",
                top: 50,
                left: 40,
                zIndex: 1000
              }}
            >
              <Text
                style={{
                  borderWidth: 1,
                  borderColor: "green",
                  color: "green",
                  fontSize: 25,
                  fontWeight: "800",
                  padding: 10
                }}
              >
                LIKE
              </Text>
            </Animated.View>

            <Animated.View
              style={{
                opacity: this.dislikeOpacity,
                transform: [{ rotate: "30deg" }],
                position: "absolute",
                top: 50,
                right: 40,
                zIndex: 1000
              }}
            >
              <Text
                style={{
                  borderWidth: 1,
                  borderColor: "red",
                  color: "red",
                  fontSize: 25,
                  fontWeight: "800",
                  padding: 10
                }}
              >
                NOPE
              </Text>
            </Animated.View>
            <Image
              style={{
                flex: 1,
                height: null,
                width: null,
                resizeMode: "cover",
                borderRadius: 20
              }}
              source={item.uri}
            />

          </Animated.View>
        );
      } else {
        return (
          <Animated.View
            key={item.id}
            style={[
              {
                opacity: this.nextCardOpacity,
                transform: [{ scale: this.nextCardScale }],
                height: SCREEN_HEIGHT - 180,
                width: SCREEN_WIDTH,
                padding: 10,
                position: "absolute"
              }
            ]}
          >
            {}
            <Image
              style={{
                flex: 1,
                height: null,
                width: null,
                resizeMode: "cover",
                borderRadius: 20
              }}
              source={item.uri}
            />
          </Animated.View>

        );
      }
    }).reverse();
  };
  render() {
    return (
      <View style={{ flex: 1 }}>
        <View
          style={{
            height: 150,
            backgroundColor: "#f99e23",
            justifyContent: "center",
            alignItems: "center",
            paddingTop: 30,
            paddingBottom: 20,

          }}
        >
          <Text style={styles.titleText}> Our Work  </Text>
        </View>

        <View style={{ flex: 1, backgroundColor: '#2C2F33' }}>{this.renderJobs()}</View>

        <View style={{ height: 0, backgroundColor: '#2C2F33' }}></View>

      </View >
    );

  }
}

HomeScreen.navigationOptions = {
  header: null
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#2C2F33"
  },
  cardView: {
    backgroundColor: "#2C2F33",
    paddingBottom: 30
  },

  titleText: {
    fontSize: 26,
    fontWeight: "bold",
    margin: 10,
    color: "white",

  },
  developmentModeText: {
    marginBottom: 20,
    color: "rgba(0,0,0,0.4)",
    fontSize: 14,
    lineHeight: 19,
    textAlign: "center"
  },
  contentContainer: {
    paddingTop: 30
  },
  welcomeContainer: {
    flex: 1,
    position: "relative",
    alignItems: "center",
    height: 150,
    marginTop: 30,
    backgroundColor: "#f99e23",
    justifyContent: "center",
    alignItems: "center",
    elevation: 10
  },
  welcomeImage: {
    width: 100,
    height: 80,
    resizeMode: "contain",
    marginTop: 3,
    marginLeft: -10
  },
  getStartedContainer: {
    alignItems: "center",
    marginHorizontal: 50
  },
  homeScreenFilename: {
    marginVertical: 7
  },
  codeHighlightText: {
    color: "rgba(96,100,109, 0.8)"
  },
  codeHighlightContainer: {
    backgroundColor: "rgba(0,0,0,0.05)",
    borderRadius: 3,
    paddingHorizontal: 4
  },
  getStartedText: {
    fontSize: 17,
    color: "rgba(96,100,109, 1)",
    lineHeight: 24,
    textAlign: "center"
  }
});

EPERM: operation not permitted, chmod @react-native-community iOS

$
0
0

I am using React 16.8.6 and react-native 0.59.6. iOS.

While typing react-native --version or anything prefix with react-native, it is showing the following error.

internal/fs/utils.js:220
    throw err;
    ^

Error: EPERM: operation not permitted, chmod '/usr/local/lib/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/server/external/xsel'
    at Object.chmodSync (fs.js:1104:3)
    at Object.<anonymous> (/usr/local/lib/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/server/copyToClipBoard.js:50:15)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/server/middleware/copyToClipBoardMiddleware.js:8:47)
    at Module._compile (internal/modules/cjs/loader.js:956:30) {
  errno: -1,
  syscall: 'chmod',
  code: 'EPERM',
  path: '/usr/local/lib/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/server/external/xsel'
}

I cleaned the project. Restarted it.

Deleted npm package and reinstalled it.

Tried npm install -g react-native-cli.

I have react-native-community/cli version 1.12.0 in package.lock.json dependancies.

I don't have any clue about what to do. I am not able to do link any libraries and other stuffs which requires react-native keyword.

Moreover, If I run it with sudo like sudo react-native --version, it is giving like below mentioned.

warn Your project is using deprecated "rnpm" config that will stop working from next release. Please use a "react-native.config.js" file to configure the React Native CLI. Migration guide: https://github.com/react-native-community/cli/blob/master/docs/configuration.md
warn The following packages use deprecated "rnpm" config that will stop working from next release:
  - react-native-google-signin: https://github.com/react-native-community/react-native-google-signin
  - react-native-video: https://github.com/react-native-community/react-native-video#readme
Please notify their maintainers about it. You can find more details at https://github.com/react-native-community/cli/blob/master/docs/configuration.md#migration-guide.
3.0.4

Please suggest some guidance regarding the same.

Thanks.

React-native IOS app goes blank on startup when i change from main.m to appdegelegate.swift

$
0
0

i am trying to convert the appdelegate.h .m and main.m (objective c files) to swift by creating appdelegate.swift (and of course deleting those files) but when i do this the app brings a black screen on startup

here is the main.m code

#import <UIKit/UIKit.h>

#import "AppDelegate.m"

int main(int argc, char * argv[]) {
@autoreleasepool {
 return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
 }
}

and appdelegate.m

#import "AppDelegate.h"

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
@import Firebase;

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary 
*)launchOptions
  {
 RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
 RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                               moduleName:@"doctor_react_app"
                                        initialProperties:nil];

 rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
 rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
 [self.window makeKeyAndVisible];
 [FIRApp configure];
 return YES;
 }

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
 return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" 
 fallbackResource:nil];
#else
 return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

@end

and here is the code am trying to using in the appdelegate.swift

import UIKit
import PushKit
import Firebase
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?

 private func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        //Enable all notification type. VoIP Notifications don't present a UI but we will use this to show local nofications later
        let notificationSettings = UIUserNotificationSettings(types: [.badge, .sound, .alert], categories: nil)

        //register the notification settings
        application.registerUserNotificationSettings(notificationSettings)

        //output what state the app is in. This will be used to see when the app is started in the background
        NSLog("app launched with state \(application.applicationState)")
        FirebaseApp.configure()
        return true
}

func application(_ application: UIApplication, didRegister notificationSettings: UIUserNotificationSettings) {

  //register for voip notifications
let voipRegistry = PKPushRegistry(queue: DispatchQueue.main)
voipRegistry.desiredPushTypes = Set([PKPushType.voIP])
  voipRegistry.delegate = self;


 }



  }
 extension AppDelegate: PKPushRegistryDelegate {

  func pushRegistry(_ registry: PKPushRegistry,
                    didUpdate pushCredentials: PKPushCredentials,
                    for type: PKPushType) {
    //print out the VoIP token. We will use this to test the notification.
    NSLog("voip token: \(pushCredentials.token)")
  }

  func pushRegistry(_ registry: PKPushRegistry,
                             didReceiveIncomingPushWith payload: PKPushPayload,
                             for type: PKPushType,
                             completion: @escaping () -> Void){
    let payloadDict = payload.dictionaryPayload["aps"] as? Dictionary<String, String>
    let message = payloadDict?["alert"]

    //present a local notifcation to visually see when we are recieving a VoIP Notification
    if UIApplication.shared.applicationState == UIApplication.State.background {

      let localNotification = UILocalNotification();
      localNotification.alertBody = message
      localNotification.applicationIconBadgeNumber = 1;
      localNotification.soundName = UILocalNotificationDefaultSoundName;

      UIApplication.shared.presentLocalNotificationNow(localNotification);
    }

    else {

      DispatchQueue.main.async(execute: { () -> Void in

        let alert = UIAlertController(title: "My Alert", message: "This is an alert.", preferredStyle: .alert)
        alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: "Default action"), style: .default, handler: { _ in
        NSLog("The \"OK\" alert occured.")
        }))

 //            alert.show()
      })
    }

    NSLog("incoming voip notfication: \(payload.dictionaryPayload)")
  }
  func pushRegistry(_ registry: PKPushRegistry,
                             didInvalidatePushTokenFor type: PKPushType) {

    NSLog("token invalidated")
  }
 }

React Native - iOS - Invalid `Podfile` file: undefined method `[]' for nil:NilClass

$
0
0

I have just started out with React Native. I was following the React Native CLI Quickstart from the official documentation. That does also mean I am up to date with React Native version 0.61.2.

Since then I have done some basic UI, checking with the result in the iPhone simulator. It works when running react-native run-ios, not really touching the ios/Podfile too much.

My problem is running pod install inside my ios/ folder always results in an error! This becomes a problem now where I need to install additional packages. But it is already failing with default Podfile!

Error message:

[!] Invalid `Podfile` file: undefined method `[]' for nil:NilClass.

 #  from /Users/marcel/Projekte/WerBinIch/ios/Podfile:43
 #  -------------------------------------------
 #  
 >    use_native_modules!
 #  end
 #  -------------------------------------------

ios/Podfile

platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'WerBinIch' do
  # Pods for WerBinIch
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'


  target 'WerBinIchTests' do
    inherit! :search_paths
    # Pods for testing
  end

  use_native_modules!
end

I have no idea how to deal with this! I have no idea how the Podfile and the thing with the xcode files really work! I was trying to delete folders accomplishing a reset. More than that I have no idea what the error message could mean.

Please tell me how to write function in jacascript

$
0
0

I was looking at this example because I wanted to show the current location on the map, just struggling to write the example in my own code

https://github.com/react-native-community/react-native-maps this is exsample

getInitialState() {
  return {
    region: {
      latitude: 37.78825,
      longitude: -122.4324,
      latitudeDelta: 0.0922,
      longitudeDelta: 0.0421,
    },
  };
}

onRegionChange(region) {
  this.setState({ region });
}

render() {
  return (
    <MapView
      region={this.state.region}
      onRegionChange={this.onRegionChange}
    />
  );
}

my code is not funcition.

const Map = () => {

  render(){
    const  getInitialState =() => {
      return {
        region: {
          latitude: 37.78825,
          longitude: -122.4324,
          latitudeDelta: 0.0922,
          longitudeDelta: 0.0421,
        },
      }
    };

   const  onRegionChange = (region) => {
        this.setState({ region });
      }


    return (
      <MapView
        style={styles.map}
        region={this.state.region}
        onRegionChange={this.state.onRegionChange}
      />
    )
  }
}

export default Map;

I'm having trouble writing the example code myself. How to make funciton work well

Please tell me how to write function in javascript [closed]

$
0
0

I was looking at this example because I wanted to show the current location on the map, just struggling to write the example in my own code

https://github.com/react-native-community/react-native-maps this is exsample

getInitialState() {
  return {
    region: {
      latitude: 37.78825,
      longitude: -122.4324,
      latitudeDelta: 0.0922,
      longitudeDelta: 0.0421,
    },
  };
}

onRegionChange(region) {
  this.setState({ region });
}

render() {
  return (
    <MapView
      region={this.state.region}
      onRegionChange={this.onRegionChange}
    />
  );
}

my code is not funcition.

const Map = () => {

  render(){
    const  getInitialState =() => {
      return {
        region: {
          latitude: 37.78825,
          longitude: -122.4324,
          latitudeDelta: 0.0922,
          longitudeDelta: 0.0421,
        },
      }
    };

   const  onRegionChange = (region) => {
        this.setState({ region });
      }


    return (
      <MapView
        style={styles.map}
        region={this.state.region}
        onRegionChange={this.state.onRegionChange}
      />
    )
  }
}

export default Map;

I'm having trouble writing the example code myself. How to make funciton work well

react-native-permissions request inside the app on button click and not on installing app

$
0
0

I am using this library to request permissions for my app.

However Privacy - Bluetooth Always Usage Description from info.plist is getting called as soon the app is installed and opened. I want this permission to be requested only when the user logs in and on click of a button. How can I achieve this?


React Native: Navigate to new page without tabs?

$
0
0

So what I want to do is very simple, but i'm not sure how to do it.

1) I have tabs on my main page.

2) The tabs pages have buttons that take me to a new page when pressed.

3) On that new page, the old tabs from my main page are still showing up. I DON'T want this to happen.

Code for creating the tabs:

  render() {
    const Tab = createMaterialTopTabNavigator();

    return (
      <Tab.Navigator tabBarOptions={{}}>
        <Tab.Screen name="Profile" component={Profile} />
        <Tab.Screen name="Swipe" component={SwipePage} />
        <Tab.Screen name="Messages" component={FemaleMessages} />
      </Tab.Navigator>
    );
  }

Stack Navigator for taking me to the next page:

    const Stack = createStackNavigator();
    return (
      <Stack.Navigator>
        <Stack.Screen
          name="Main"
          component={test}
          options={{
            headerTransparent: true,
            headerTitle: '',
            headerLeft: null,
          }}
        />
        <Stack.Screen
          name="Settings"
          component={Settings}
          options={{
            headerTransparent: true,
            headerTitle: '',
            headerBackTitle: 'Home',
          }}
        />
...
)

And the button for taking me to the new page: (Tried "replace", "navigate", "push")

<TouchableOpacity
          style={{marginLeft: 20, marginRight: 20}}
          onPress={() =>
            navigation.replace('Settings', {tabBarVisible: false})
          }>
          <Image
            source={require('../images/close.png')}
            style={{width: 40, height: 40}}></Image>
        </TouchableOpacity>

Why my react-native app is crashing in XCode Build?

$
0
0

After a lot of work I was able to build my app for ios, but after it succeeds building the app crashes and some logs appear in the xcode:

2020-02-16 23:01:58.268 [info][tid:main][RCTCxxBridge.mm:213] Initializing <RCTCxxBridge: 0x7f899241ec10> (parent: <RCTBridge: 0x600000188770>, executor: (null))
2020-02-16 23:01:58.418 [warn][tid:main][RCTModuleData.mm:67] Module RNFetchBlob requires main queue setup since it overrides `constantsToExport` but doesn't implement `requiresMainQueueSetup`. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.
2020-02-16 23:01:58.429 [info][tid:main][RCTCxxBridge.mm:213] Initializing <RCTCxxBridge: 0x7f899260ff00> (parent: <RCTBridge: 0x6000001ae7d0>, executor: (null))
2020-02-16 23:01:58.431 [warn][tid:main][RCTModuleData.mm:67] Module RNFetchBlob requires main queue setup since it overrides `constantsToExport` but doesn't implement `requiresMainQueueSetup`. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.
2020-02-16 23:01:58.537 [warn][tid:NSOperationQueue 0x7f89925157c0 (QOS: UNSPECIFIED)][RCTModuleData.mm:248] RCTBridge required dispatch_sync to load RCTDevLoadingView. This may lead to deadlocks
2020-02-16 23:01:58.656 [warn][tid:NSOperationQueue 0x7f89926135a0 (QOS: UNSPECIFIED)][RCTModuleData.mm:248] RCTBridge required dispatch_sync to load RCTDevLoadingView. This may lead to deadlocks
2020-02-16 23:01:59.275 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/utils/apps.js -> node_modules/react-native-firebase/dist/modules/core/app.js -> node_modules/react-native-firebase/dist/utils/apps.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2020-02-16 23:01:59.277 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/admob/index.js -> node_modules/react-native-firebase/dist/modules/admob/Interstitial.js -> node_modules/react-native-firebase/dist/modules/admob/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2020-02-16 23:01:59.277 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/utils/apps.js -> node_modules/react-native-firebase/dist/modules/core/app.js -> node_modules/react-native-firebase/dist/utils/apps.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2020-02-16 23:01:59.278 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/admob/index.js -> node_modules/react-native-firebase/dist/modules/admob/RewardedVideo.js -> node_modules/react-native-firebase/dist/modules/admob/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2020-02-16 23:01:59.279 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/admob/index.js -> node_modules/react-native-firebase/dist/modules/admob/Interstitial.js -> node_modules/react-native-firebase/dist/modules/admob/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2020-02-16 23:01:59.281 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/admob/index.js -> node_modules/react-native-firebase/dist/modules/admob/RewardedVideo.js -> node_modules/react-native-firebase/dist/modules/admob/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2020-02-16 23:01:59.285 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/database/Reference.js -> node_modules/react-native-firebase/dist/utils/SyncTree.js -> node_modules/react-native-firebase/dist/modules/database/Reference.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2020-02-16 23:01:59.287 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/database/Reference.js -> node_modules/react-native-firebase/dist/utils/SyncTree.js -> node_modules/react-native-firebase/dist/modules/database/Reference.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2020-02-16 23:01:59.288 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/core/firebase.js -> node_modules/react-native-firebase/dist/utils/apps.js -> node_modules/react-native-firebase/dist/modules/core/app.js -> node_modules/react-native-firebase/dist/modules/database/index.js -> node_modules/react-native-firebase/dist/modules/core/firebase.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2020-02-16 23:01:59.289 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/core/firebase.js -> node_modules/react-native-firebase/dist/utils/apps.js -> node_modules/react-native-firebase/dist/modules/core/app.js -> node_modules/react-native-firebase/dist/modules/database/index.js -> node_modules/react-native-firebase/dist/modules/core/firebase.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2020-02-16 23:01:59.290 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/firestore/DocumentSnapshot.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentSnapshot.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2020-02-16 23:01:59.290 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/firestore/CollectionReference.js -> node_modules/react-native-firebase/dist/modules/firestore/Query.js -> node_modules/react-native-firebase/dist/modules/firestore/QuerySnapshot.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentChange.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentSnapshot.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js -> node_modules/react-native-firebase/dist/modules/firestore/CollectionReference.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2020-02-16 23:01:59.291 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js -> node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2020-02-16 23:01:59.291 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js -> node_modules/react-native-firebase/dist/modules/firestore/FieldValue.js -> node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2020-02-16 23:01:59.292 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/firestore/DocumentSnapshot.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentSnapshot.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2020-02-16 23:01:59.292 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/firestore/CollectionReference.js -> node_modules/react-native-firebase/dist/modules/firestore/Query.js -> node_modules/react-native-firebase/dist/modules/firestore/QuerySnapshot.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentChange.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentSnapshot.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js -> node_modules/react-native-firebase/dist/modules/firestore/CollectionReference.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2020-02-16 23:01:59.292 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js -> node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2020-02-16 23:01:59.293 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js -> node_modules/react-native-firebase/dist/modules/firestore/FieldValue.js -> node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2020-02-16 23:01:59.293 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/core/firebase.js -> node_modules/react-native-firebase/dist/utils/apps.js -> node_modules/react-native-firebase/dist/modules/core/app.js -> node_modules/react-native-firebase/dist/modules/functions/index.js -> node_modules/react-native-firebase/dist/modules/core/firebase.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2020-02-16 23:01:59.295 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/core/firebase.js -> node_modules/react-native-firebase/dist/utils/apps.js -> node_modules/react-native-firebase/dist/modules/core/app.js -> node_modules/react-native-firebase/dist/modules/functions/index.js -> node_modules/react-native-firebase/dist/modules/core/firebase.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2020-02-16 23:01:59.300 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/storage/index.js -> node_modules/react-native-firebase/dist/modules/storage/reference.js -> node_modules/react-native-firebase/dist/modules/storage/task.js -> node_modules/react-native-firebase/dist/modules/storage/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
2020-02-16 23:01:59.303 [warn][tid:com.facebook.react.JavaScript] Require cycle: node_modules/react-native-firebase/dist/modules/storage/index.js -> node_modules/react-native-firebase/dist/modules/storage/reference.js -> node_modules/react-native-firebase/dist/modules/storage/task.js -> node_modules/react-native-firebase/dist/modules/storage/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.

The XCode goes to this file (string.h) and gives this error too, 'com.facebook.react.JavaScript (13): EXC_BAD_ACCESS (code=1, address=0x2)'

I just want to know if anyone has any idea of what the error could be. I don't even need a solution, just to know why the app is crashing.

React-Native Bundle Error error SHA-1 for file is not computed

$
0
0

I am facing this error while creating bundle of react-native app.

I am executing command react-native bundle --dev false --entry-file index.js --bundle-output ios/main.jsbundle --platform ios

error SHA-1 for file /usr/local/lib/node_modules/react-native/node_modules/metro/src/lib/polyfills/require.js (/usr/local/lib/node_modules/react-native/node_modules/metro/src/lib/polyfills/require.js) is not computed. Run CLI with --verbose flag for more details.
ReferenceError: SHA-1 for file /usr/local/lib/node_modules/react-native/node_modules/metro/src/lib/polyfills/require.js (/usr/local/lib/node_modules/react-native/node_modules/metro/src/lib/polyfills/require.js) is not computed
    at DependencyGraph.getSha1 (/usr/local/lib/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph.js:258:13)
    at /usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/Transformer.js:211:26
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/Transformer.js:46:24)
    at _next (/usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/Transformer.js:66:9)
    at /usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/Transformer.js:71:7
    at new Promise (<anonymous>)
    at /usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/Transformer.js:63:12
    at Transformer.transformFile (/usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/Transformer.js:236:7)
    at /usr/local/lib/node_modules/react-native/node_modules/metro/src/Bundler.js:87:34

react-native info command output

info Fetching system and libraries information...
System:
    OS: macOS Mojave 10.14.3
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Memory: 1.73 GB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.16.0 - /usr/local/bin/node
    Yarn: 1.19.1 - /usr/local/bin/yarn
    npm: 6.13.4 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
    Android SDK:
      API Levels: 23, 25, 26, 27, 28, 29
      Build Tools: 27.0.3, 28.0.3
      System Images: android-29 | Google Play Intel x86 Atom
      Android NDK: 20.1.5948944
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5522156
    Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.5 => 0.61.5 
  npmGlobalPackages:
    create-react-native-app: 2.0.2
    react-native-cli: 2.0.1
    react-native: 0.61.5

What’s the purpose of having app transport security settings in info.plist in a react native app

$
0
0

What’s the purpose of having these settings in info plist:

1) allow arbitrary reload = true

2) exception domains —> localhost —> NSExceptionInsecureHTTLoads = yes

info.plist in Xcode

Is this just for development purposes?

Do I need to remove it when building production IPA?

How to send value to another screen in React Native with hooks?

$
0
0

I am building a weather app. The in-home screen of the app I fetch data from IP/read API every 5 seconds and that works fine. What I want to do now is to fetch data from IP/insert when I press the button in Links Screen and then send that value to HomeScreen. I found a lot of tutorials for that but not any with react hooks.

This is my HomeScreen.js file:

import React, {useState, useEffect} from 'react';
import {Image, Platform, ScrollView, StyleSheet, Text, TouchableOpacity, View, StatusBar, ActivityIndicator} from 'react-native';
import { Icon } from 'react-native-elements';
import * as Font from 'expo-font'

HomeScreen.navigationOptions = {
  header: null,
};

export default function HomeScreen() {
  const [city, setCity] = useState('--');
  const [countrycode, setCountryCode] = useState('0');
  const [icon, setIcon] = useState('ios-sunny');
  const [date, setDate] = useState('00.00');
  const [temperature, setTemperature] = useState('0');
  const [wind, setWind] = useState('0');
  const [humidity, setHumidity] = useState('0');
  const [temperatureInside, setTemperatureInside] = useState('0');
  const [humidityInside, setHumidityInside] = useState('0');
  const [pressure, setPressure] = useState('0');
  const [spinner, setSpinner] = useState(false);
  const [fontLoaded, setFontLoaded] = useState(false); 
  useEffect(() => {
    Font.loadAsync({
      'raleway-regular': require('../assets/fonts/Raleway-Regular.ttf'),
      'raleway-light': require('../assets/fonts/Raleway-Light.ttf'),
    });
    setFontLoaded(true);
    const interval = setInterval(() => {
      fetch('http://192.168.88.253:5000/read')
    .then((response) => response.json())
    .then((responseJson) => {
      setCity(responseJson.city);
      setCountryCode(responseJson.countrycode);
      //setIcon
      if(responseJson.description === 'clear sky'){
        setIcon('ios-sunny');
      }if(responseJson.description === 'few clouds' || responseJson.description === 'scattered clouds',responseJson.description === 'broken clouds'){
        setIcon('ios-partly-sunny');
      }if(responseJson.description === 'light rain' || responseJson.description === 'shgower rain' || responseJson.description === 'shower rain'){
        setIcon('md-rainy');
      }if(responseJson.description === 'thunderstorm'){
        setIcon('md-thunderstorm');
      }if(responseJson.description === 'snow'){
        setIcon('md-snow');
      }if(responseJson.description === 'mist'){
        setIcon('md-partly-sunny');
      }
      setTemperature(responseJson.temperature);
      setWind(responseJson.wind_speed);
      setHumidity(responseJson.humidity);
      setTemperatureInside(responseJson.temperatureInside);
      setHumidityInside(responseJson.humidityInside);
      setDate(responseJson.time);
      setTemperatureInside(responseJson.temperatureInside);
      setHumidityInside(responseJson.humidityInside);
      setPressure(responseJson.pressure);
    })
    .catch((error) => {
      console.warn(error);
    }); 
    }, 5000);
    return () => clearInterval(interval);
  }, []);

  return (
    <View style={styles.container}>
      <View style={styles.upperContainer}>
        <View style={styles.oneVertical}>
          <Text style={styles.city}>{city.toUpperCase()}, </Text>
          <Text style={styles.countrycode}>{countrycode}</Text> 
        </View>
        <View style={styles.twoVertical}>
          <Icon name={icon} type='ionicon' iconStyle={styles.icon}></Icon>
          <Text style={styles.date}>{date}</Text>  
        </View>
        <View style={styles.threeVertical}>
          <View style={styles.tempView}>
            <Text style={styles.temperature}>{Math.round(temperature)}°</Text>
          </View>
          <View style={styles.otherView}>
            <View style={styles.humidityTemp}>
              <Icon iconStyle={styles.otherViewIcon} type='ionicon' name='ios-jet'></Icon>
              <Text style={{color:'#fff', fontSize:20, fontFamily: 'raleway-regular',}}> {Math.round(wind)} km/h</Text>
            </View>
            <View style={styles.humidityTemp}>
              <Icon iconStyle={styles.otherViewIcon} type='ionicon' name='ios-water'></Icon>
              <Text style={{color:'#fff', fontSize:20, fontFamily: 'raleway-regular',}}>  {humidity} %</Text>
            </View>
          </View>
        </View>
      </View>
      <View style={styles.lowerContainer}>
        <View style={styles.ChamberView}>
          <Text style={{color:'#fff', fontFamily: 'raleway-regular',}}>TEMP.</Text>
          <Icon iconStyle={{color:'#fff', fontSize:30, marginVertical:10, }} type='ionicon' name='md-thermometer'></Icon>
          <Text style={{color:'#fff', fontSize:20, fontFamily: 'raleway-regular',}}>{temperatureInside}°</Text>
        </View>
        <View style={styles.ChamberView}>
          <Text style={{color:'#fff', fontFamily: 'raleway-regular',}}>VLAGA</Text>
          <Icon iconStyle={{color:'#fff', fontSize:30, marginVertical:10, }} type='ionicon' name='ios-water'></Icon>
          <Text style={{color:'#fff', fontSize:20, fontFamily: 'raleway-regular',}}>{humidityInside} %</Text>
        </View>
        <View style={styles.ChamberView}>
          <Text style={{color:'#fff', fontFamily: 'raleway-regular',}}>TLAK</Text>
          <Icon iconStyle={{color:'#fff', fontSize:30, marginVertical:10, }} type='ionicon' name='ios-hand'></Icon>
          <Text style={{color:'#fff', fontSize:20, fontFamily: 'raleway-regular',}}>{pressure} bar</Text>
        </View>
      </View>
    </View>
  );
}

and there is LinksScreen.js file:

import React, {useState} from 'react';
import { View, StyleSheet, Alert, ActivityIndicator } from 'react-native';
import {SearchBar, Button} from 'react-native-elements';
import MapView from 'react-native-maps';
import Spinner from 'react-native-loading-spinner-overlay';
import { NavigationEvents } from 'react-navigation';

export default function LinksScreen() {
  const [spinner, setSpinner] = useState(false);
  const [search, setSearch] = useState('');
  const handleChange = event => {
    setSearch(event);
  }
  const [latitudePress, setLatitude] = useState('46.54306');
  const [longitudePress,setLongitude] = useState('14.96917');
  function addMarkerAndRequest(e){
    setLatitude(e.nativeEvent.coordinate.latitude); 
    setLongitude(e.nativeEvent.coordinate.longitude);
    const coords = {
      latitude: e.nativeEvent.coordinate.latitude,
      longitude: e.nativeEvent.coordinate.longitude
    };
    Alert.alert(
      'Sprememba mesta',
      'Stanje v komori se bo spremenilo. Ali ste prepričani?',
      [
        {
          text: 'NE',
          onPress: () => console.log('Cancel Pressed'),
          style: 'cancel',
        },
        {
          text: 'OK', 
          onPress: () => {
            fetch(`http://192.168.88.253:5000/insert/${coords.longitude}/${coords.latitude}`);
            setSpinner(true);
            setTimeout(() => setSpinner(false), 2000);
          }
        },
      ],
      {cancelable: false},
    )
  }

  return (
    <View style={styles.container}>
      <Spinner
          visible={spinner}
          textStyle={styles.spinnerTextStyle}
      />
      <SearchBar
        containerStyle={{borderColor:'#eee', borderWidth:1}}
        placeholder="Vnesi mesto.."
        onChangeText={(e) => {setSearch(e)}}
        value={search}
        platform='android'
      />
      <MapView
        style={{width:'100%', height:'80%'}}
        initialRegion={{
        latitude: Number(latitudePress),
        longitude: Number(longitudePress),
        latitudeDelta: 0.0922,
        longitudeDelta: 0.0421,
        }}
        onPress={ (event) => addMarkerAndRequest(event) }
      >
        <MapView.Marker
            coordinate={{latitude: Number(latitudePress),
            longitude: Number(longitudePress)}}
            title={`ZŠ: ${latitudePress}, ZD: ${longitudePress}`}
         />
      </MapView>
      <Button 
        onPress={()=>Alert.alert(
          'Sprememba mesta',
          'Stanje v komori se bo spremenilo. Ali ste prepričani?',
          [
            {
              text: 'NE',
              onPress: () => console.log('Cancel Pressed'),
              style: 'cancel',
            },
            {
              text: 'OK', 
              onPress: () => {
                fetch(`http://192.168.88.253:5000/insertcity/${search}`);
                setSpinner(true);
                setTimeout(() => setSpinner(false), 2000);
                setSearch('');
              }
            },
          ],
          {cancelable: false},
        )}
        title='POTRDI'></Button>
    </View>
  );
}

LinksScreen.navigationOptions = {
  title: 'Zemljevid',
};

react native crash when tapping navigation button too fast

$
0
0

I used react navigation 4.0.10 and it's little bit complicated app with nested navigator. Currently it's performing relatively well except that When I try to navigate it very fast, it will crash. The error message is

TypeError: undefined is not an object (evaluating 'navigation.state')

The structure is

-bottomTapNavigator(Home, Scan; Scan is a stackNavigator)
 --HomeScreen
 --ScanNavigator(stackNavigator, parent for ScanScreen and JourneyNavigator[tabNavigator])
   ---ScanScreen(Real page, initial screen of ScanNavigator, having buttons to navigate(HomeScreen) and navigate(JourneyNavigator))
   ---JourneyNavigator(TabNavigator, including ScreenTest1 and ScreenTest2; having header with back button navigate(ScanScreen) for both ScreenTest1 and ScreenTest2;)
      ---ScreenTest1(Real page)
      ---ScreenTest2(Real page, does not matter in this case)

what I do is tap ScanNavigator[ScanScreen]->ScreenTest1->ScanScreen(tap navigation button quickly here)->HomeScreen

In such case, the app will crash. If i do it with normal pace then it's fine.

Any help or direction is welcome.

EDIT

I'm 100 percent certain it's something to do with resetOnBlur setting. When it set to false, the issue gone. Help please.

Framework is not found in CoreModules

$
0
0

I have a react native app and i am using xcode 11.3.1. I have opened the .xworkspace file and I keep getting error

Showing Recent Messages : Framework not found CoreModules

my podfile is this

platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'XXX' do
  use_frameworks!
  # Pods for XXX
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'


  pod 'react-native-webview', :path => '../node_modules/react-native-webview'
  pod 'react-native-idfa',  path: '../libs/@ptomasroos/react-native-idfa'
  pod 'react-native-date-picker',  path: '../node_modules/react-native-date-picker'

  pod 'react-native-image-picker',  path: '../node_modules/react-native-image-picker'

  pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"

  pod 'FBSDKCoreKit', '5.8'
  pod 'FBSDKShareKit', '5.8'

  target 'XXXTests' do
    inherit! :search_paths
    # Pods for testing
  end

  use_native_modules!
end

target 'XXX-tvOS' do
  # Pods for XXX-tvOS

  target 'XXX-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

I have tried to add coreModules to linked frameworks, I have deleted path from framework search paths and header paths, add them back, clear dervide data and clean the project. Any other thoughts?


I am using react-native 0.57, is there anyway to get UID/tag id of a NFC tag on ios

$
0
0

I am using react-native-nfc-manager. But the uid or id of NFC tag is coming as undefined for ios. On android it works very well.

Crashlytics not sending events on iOS

$
0
0

I've migrated our app from react-native-firebase to @react-native-firebase/crashlytics and managed to get crash reports from Android, but no luck with iOS.

I've done all the following:

  • removed react-native-fabric and all of it's references
  • installed @react-native-firebase/app
  • installed @react-native-firebase/crashlytics
  • added GoogleServices-info.plist in xCode as described in the manual
  • added firebase.json in the root of the app with crashlytics_debug_enabled: true (this solved Android)

But still no success, not from the simulator nor from appCenter deployed app.

I think it's good to mention that we have 3 schemes (dev, staging, production).

Any idea how to make this work?

React native firebase in background ios

$
0
0

I have problem on react-native 0.60.6 with react-native-firebase 5.6.0 module. My app doesn't has notification in background mode on iPhone. I want get notification in background mode and save this notification. Is it possible?

Deep linking with react-native-quick-actions is not working in iOS

$
0
0

I am trying to implement quick actions in my react native app.

lets say:

There are 3 shortcut items. When long pressed in app icon, it will show these menus but when tapped those, it just opens app, but deep linking is not working.

But whenever I enter those urls in safari, deep linking works. (app does open and navigate to mentioned screen)

NOTE: currently working in iOS only

QuickActions.setShortcutItems([
            {
                type: "Camera", 
                title: "Camera", 
                subtitle: "",
                icon: "Camera", 
                userInfo: {
                    url: "app://camera"
                }
            },
            {
                type: "Profile", 
                title: "Profile", 
                subtitle: "",
                icon: "Contact", 
                userInfo: {
                    url: "app://profile"
                }
            },
            {
                type: "Change Password", 
                title: "Change Password", 
                subtitle: "",
                icon: "Cloud", 
                userInfo: {
                    url: "app://change"
                }
            }

        ]);

I am using:

"react-native-quick-actions": "^0.3.13",

"react": "16.8.6",

"react-native": "0.60.5",

Disable application badge icon on receiving notification in ios

$
0
0

I am using react-native-applozic-chat for handling chats in my react-native app. My question is there any way to prevent the app badge icon from appearing on app icon after receiving any chat notification? I want to disable it specifically in ios because it does not appear in android.

Viewing all 17139 articles
Browse latest View live


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