小编Rus*_*iya的帖子

React Native:如何动态更改<Text>值

我想在某些事件中动态更改值

事件:

BackgroundGeolocation.on('location', (location) => {      
    currentDistance =  distance(previousLatitude,previousLongitude,latitude,longitude);

            this.setState({
                text: currentDistance                
            });                                   

    });
<Text>
   Moving : {this.state.text}
</Text>
Run Code Online (Sandbox Code Playgroud)

有谁知道如何更改文本或任何其他方法来实现?

react-native

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

领域:删除特定对象

我正在使用react native开发应用程序,我需要删除特定的对象,这些对象在过滤方法中给了我,但这给了我一个错误

“只能删除事务中的对象。”

这是我的代码

allObj1 = {
                id : 1,
                speed : "1",
                accuracy: "100",
                bearing: "1",
                longitude: "192",
                altitude: "1111",
                latitude: "1111",
                time: "11111",
                locationProvider: "2222",
            };

        allObj2 = {
                id : 2,
                speed : "1",
                accuracy: "100",
                bearing: "1",
                longitude: "192",
                altitude: "1111",
                latitude: "1111",
                time: "22222",
                locationProvider: "2222",
            };

        allObj3 = {
                id : 3,
                speed : "1",
                accuracy: "100",
                bearing: "1",
                longitude: "192",
                altitude: "1111",
                latitude: "1111",
                time: "333333",
                locationProvider: "2222",
            };

        realm.write(() => {
            realm.create('Location',allObj1 …
Run Code Online (Sandbox Code Playgroud)

realm react-native

4
推荐指数
2
解决办法
5424
查看次数

标签 统计

react-native ×2

realm ×1