标签: react-native-ios

React-Native 地理定位中的超时和最大年龄是多少

我目前正在学习react-native,我正在开发一个使用地理定位来查找和更新我当前位置的应用程序,我正在遵循该教程,在教程中我必须使用带有超时和maximumAge选项属性。

navigator.geolocation.getCurrentPosition((pozitie)=>{
        var lat = parseFloat(position.coords.latitude)
        var long = parseFloat(position.coords.longitude)

        // create an object with the current position taken from the geolocation chip
        var initialLocation = {
          latitude = lat,
          longitude = long,

          // Delta is the viewing angle on the location of the user
          latitudeDelta: LATITUDE_DELTA,
          longitudeDelta: LONGITUDE_DELTA
        }
        // Now we are seting initial position to the initial location 
        this.setState({initialPositionOnTheMap: initialLocation})

        // we set the marker to the initial location and then the display …
Run Code Online (Sandbox Code Playgroud)

geolocation react-native react-native-ios

3
推荐指数
1
解决办法
5553
查看次数

类型错误:无法读取未定义的属性“SHORT”

我正在使用笑话和酶为 React Native 应用程序编写单元测试。当我尝试运行测试用例时,出现以下错误:

\n\n
\n

\xe2\x97\x8f 测试套件运行失败

\n\n

类型错误:无法读取未定义的属性“SHORT”

\n\n

在对象。(node_modules/react-native-simple-toast/index.js:7:23)\n 在对象处。(src/client/components/Catalogue/events.js:10:29)\n 在对象处。(测试/events-test.js:5:13)\n 在 Generator.next ()\n 在 new Promise ()\n 在 Generator.next ()\n 在

\n
\n\n

该错误是由于从react-native-simple-toast导入Toast造成的。如果没有这个导入,测试运行正常,但我的组件中需要react-native-simple-toast,因此无法删除它。我以某种方式需要测试在我的组件中使用react-native-simple-toast运行:

\n\n
import React, { Component } from 'react'\nimport { Platform, ActivityIndicator, Linking, Dimensions, View, Text, \nTouchableOpacity, TextInput, StyleSheet, Keyboard, Image, \nKeyboardAvoidingView } from 'react-native'\nimport { Container, Header, Card, CardItem, Content, Left, Right, Body, \nTitle, Icon, Button } from 'native-base';\nimport IconIOSback from 'react-native-vector-icons/Ionicons';\nimport IconMenu from 'react-native-vector-icons/MaterialIcons';\nimport axios from 'axios';\nimport SERVER_URL from …
Run Code Online (Sandbox Code Playgroud)

unit-testing jestjs react-native enzyme react-native-ios

3
推荐指数
1
解决办法
3234
查看次数

React Native Pod 错误 - [!] 无效的 `Podfile` 文件:767:“”处出现意外标记。| 相关问题 #448

我已经尝试过: #448

\n\n

环境

\n\n
System:\nOS: macOS 10.15\nCPU: (4) x64 Intel(R) Core(TM) i5-4250U CPU @ 1.30GHz\nMemory: 30.63 MB / 4.00 GB\nShell: 3.2.57 - /bin/sh\nBinaries:\nNode: 10.15.3 - /usr/local/bin/node\nYarn: 1.19.2 - /usr/local/bin/yarn\nnpm: 6.13.1 - /usr/local/bin/npm\nSDKs:\niOS SDK:\nPlatforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1\nIDEs:\nXcode: 11.2.1/11B500 - /usr/bin/xcodebuild\nnpmPackages:\nreact: 16.9.0 => 16.9.0\nreact-native: 0.61.5 => 0.61.5\n
Run Code Online (Sandbox Code Playgroud)\n\n

描述

\n\n

在此输入图像描述

\n\n
\xe2\x9e\x9c ios git:(master) \xe2\x9c\x97 pod install --verbose\n/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin19/rbconfig.rb:229: warning: Insecure world writable dir /Users/jack/Desktop/root in PATH, mode 040777\n\n[!] Invalid Podfile file: 767: unexpected token …
Run Code Online (Sandbox Code Playgroud)

cocoapods react-native react-native-ios react-native-cli

3
推荐指数
1
解决办法
1万
查看次数

onShouldStartLoadWithRequest 在 WebView 中加载任何 url 时自动调用 iOS React Native,如何控制它?

我正在为我的应用程序实施应用程序WebView。我必须打开一些信息页面,并且必须根据 web 视图中任何特定位置(包含不同类型的数据)的点击来获取一些数据。但在 iOS 中,在加载任何 URL 时onShouldStartLoadWithRequest会自动调用,这会导致在 HTML 内容中打开不同的 URL。但它在 Android 中按预期工作。

<WebView
  originWhitelist={["*"]}
  style={style}
  source={source}
  showsVerticalScrollIndicator={showsVerticalScrollIndicator}
  startInLoadingState={startInLoadingState}
  javaScriptEnabled={true}
  onShouldStartLoadWithRequest={request => {
    return onLoadWebViewOnClick(request)
  }}
/>
Run Code Online (Sandbox Code Playgroud)

在这个handleUrlNavigation中会处理任何点击动作的请求,但是它每次都会自动调用。我该如何处理这个问题?

ios react-native react-native-ios react-native-webview

3
推荐指数
1
解决办法
1万
查看次数

React Native 运行错误:“无法构建 iOS 项目。我们运行了“xcodebuild”命令,但它退出并显示错误代码 65”

我\xe2\x80\x99m 尝试使用该npm run ios命令运行我的React Native 项目。\n但由于某些问题,它一次又一次无法运行。\n它打印出的错误消息如下所示。

\n
GetRest@0.0.1 ios /Users/user/Documents/w_space/bo.git/getrest\n\nreact-native run-ios\n\nerror Could not find the following native modules: RNSVG, RNSVG. Did you forget to run "pod install" ?\n\ninfo Found Xcode workspace "GetRest.xcworkspace"\n\ninfo Building (using "xcodebuild -workspace GetRest.xcworkspace -configuration Debug -scheme GetRest -destination id=81866BE1-BBBB-4A67-990A-3B0B8A613075")\n\n.............\n\nerror Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening GetRest.xcworkspace. Run CLI with --verbose flag …
Run Code Online (Sandbox Code Playgroud)

react-native react-native-ios

3
推荐指数
2
解决办法
2万
查看次数

按下按钮时,React native添加活动类

我在原生项目iOS应用程序上有3个按钮.如何将类激活设置为单击按钮并从其他人中删除此类?就像我在jquery上使用的addClass/removeClass一样?

react-native react-native-ios

2
推荐指数
1
解决办法
4702
查看次数

2
推荐指数
2
解决办法
3万
查看次数

React Native ScrollView with pagination +显示下一页的一部分

我正在尝试创建一个界面,其中卡片一次一个地呈现给用户.用户可以以分页的方式向​​左和向右滚动.我还想查看当前卡片左侧和右侧的少量卡片,作为暗示还有更多内容可供查看.一个非常粗略的例子是:

在此输入图像描述

目前的代码是:

<ScrollView
   style={{width: Dimensions.get('window').width, height: 300}}
   horizontal={true}
   pagingEnabled={true}
   showsHorizontalScrollIndicator={false}
   alwaysBounceHorizontal={false}
   automaticallyAdjustContentInsets={false}>
    <View style={{width: 200, height: 300}}></View>
    <View style={{width: 200, height: 300}}></View>
    <View style={{width: 200, height: 300}}></View>
 </ScrollView>
Run Code Online (Sandbox Code Playgroud)

javascript react-native react-native-ios

2
推荐指数
1
解决办法
2706
查看次数

我如何在React Native中设置iPhone X上凹口的颜色

我一直在通过iOS Simulator在iPhone X上测试我的应用程序。我想知道如何将黑色凹口重新着色为与应用程序主题相同的颜色。

这是当前的实现:

在此处输入图片说明

如何将黑条更改为蓝色,以匹配我的主题?

javascript react-native react-native-ios iphone-x

2
推荐指数
1
解决办法
3580
查看次数

将Json响应加载到本机响应中的下拉列表中

我在我的应用程序中使用了材料下拉列表

<Dropdown 
  baseColor='white'
  itemColor='white'
  label='Select Cluster'
/>
Run Code Online (Sandbox Code Playgroud)

我像这样获取JSON对象,它工作正常.

  fetch('url', {  
    method: 'POST',
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      username : "admin"
    })
  }).then((response) => response.json())
  .then((responseJson) => {
    var count = Object.keys(responseJson.message.Obj).length;
    for(var i=0;i<count;i++){
      console.log(responseJson.message.Obj[i].name) // I need to add 
      //these names to dropdown
    }
  })
  .catch((error) => {
    console.error(error);
  });
Run Code Online (Sandbox Code Playgroud)

现在我需要将responseJson.message.Obj[i].name值添加到我的下拉列表中.

javascript react-native react-native-android react-native-ios

2
推荐指数
1
解决办法
2919
查看次数