Skip to content

Commit

Permalink
fix: 修复 offXXXXChange 不生效的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
iChengbo committed Aug 17, 2021
1 parent 24a00e0 commit fdf79c1
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 36 deletions.
12 changes: 6 additions & 6 deletions src/pages/apis/pages/device/accelerometer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
* @Author: iChengbo
* @Date: 2021-08-02 15:44:28
* @LastEditors: iChengbo
* @LastEditTime: 2021-08-03 11:04:30
* @LastEditTime: 2021-08-17 11:31:34
* @FilePath: /taro-react-native/src/pages/apis/pages/device/accelerometer/index.tsx
*/
import Taro from "@tarojs/taro-rn";
import { Button, View } from "@tarojs/components";
import { useState } from "react";
import { useCallback, useState } from "react";
import JSONTree from '../../../../components/jsontree';

import "./index.scss";
Expand All @@ -16,15 +16,15 @@ const Index = () => {
const [accelerometer1, setAccelerometer1] = useState({});
const [accelerometer2, setAccelerometer2] = useState({});

const _handleCallback1 = (res) => {
const _handleCallback1 = useCallback((res) => {
console.log("回调函数 C1", res);
setAccelerometer1(res);
}
}, []);

const _handleCallback2 = (res) => {
const _handleCallback2 = useCallback((res) => {
console.log("回调函数 C2", res);
setAccelerometer2(res);
}
}, []);

return (
<View className="api-page">
Expand Down
12 changes: 6 additions & 6 deletions src/pages/apis/pages/device/deviceMotion/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
* @Author: iChengbo
* @Date: 2021-08-02 15:44:28
* @LastEditors: iChengbo
* @LastEditTime: 2021-08-03 11:20:13
* @LastEditTime: 2021-08-17 11:33:26
* @FilePath: /taro-react-native/src/pages/apis/pages/device/deviceMotion/index.tsx
*/
import Taro from "@tarojs/taro-rn";
import { Button, View } from "@tarojs/components";
import { useState } from "react";
import { useCallback, useState } from "react";
import JSONTree from '../../../../components/jsontree';

import "./index.scss";
Expand All @@ -16,15 +16,15 @@ const Index = () => {
const [deviceMotion1, setDeviceMotion1] = useState({});
const [deviceMotion2, setDeviceMotion2] = useState({});

const _handleCallback1 = (res) => {
const _handleCallback1 = useCallback((res) => {
console.log("回调函数 C1", res);
setDeviceMotion1(res);
}
}, []);

const _handleCallback2 = (res) => {
const _handleCallback2 = useCallback((res) => {
console.log("回调函数 C2", res);
setDeviceMotion2(res);
}
}, []);

return (
<View className="api-page">
Expand Down
12 changes: 6 additions & 6 deletions src/pages/apis/pages/device/gyroscope/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
* @Author: iChengbo
* @Date: 2021-08-02 15:44:28
* @LastEditors: iChengbo
* @LastEditTime: 2021-08-03 11:05:48
* @LastEditTime: 2021-08-17 11:33:57
* @FilePath: /taro-react-native/src/pages/apis/pages/device/gyroscope/index.tsx
*/
import Taro from "@tarojs/taro-rn";
import { Button, View } from "@tarojs/components";
import { useState } from "react";
import { useCallback, useState } from "react";
import JSONTree from '../../../../components/jsontree';

import "./index.scss";
Expand All @@ -16,15 +16,15 @@ const Index = () => {
const [gyroscope1, setGyroscope1] = useState({});
const [gyroscope2, setGyroscope2] = useState({});

const _handleCallback1 = (res) => {
const _handleCallback1 = useCallback((res) => {
console.log("回调函数 C1", res);
setGyroscope1(res);
}
}, []);

const _handleCallback2 = (res) => {
const _handleCallback2 = useCallback((res) => {
console.log("回调函数 C2", res);
setGyroscope2(res);
}
}, []);

return (
<View className="api-page">
Expand Down
12 changes: 6 additions & 6 deletions src/pages/apis/pages/device/network/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
* @Author: iChengbo
* @Date: 2021-08-02 15:44:28
* @LastEditors: iChengbo
* @LastEditTime: 2021-08-03 15:40:10
* @LastEditTime: 2021-08-17 11:34:23
* @FilePath: /taro-react-native/src/pages/apis/pages/device/network/index.tsx
*/
import Taro from "@tarojs/taro-rn";
import { Button, View } from "@tarojs/components";
import { useState } from "react";
import { useCallback, useState } from "react";
import JSONTree from '../../../../components/jsontree';

import "./index.scss";
Expand All @@ -16,15 +16,15 @@ const Index = () => {
const [networkStatus1, setNetworkStatus1] = useState({});
const [networkStatus2, setNetworkStatus2] = useState({});

const _handleCallback1 = (res) => {
const _handleCallback1 = useCallback((res) => {
console.log("回调函数 C1", res);
setNetworkStatus1(res);
}
}, []);

const _handleCallback2 = (res) => {
const _handleCallback2 = useCallback((res) => {
console.log("回调函数 C2", res);
setNetworkStatus2(res)
}
}, []);

return (
<View className="api-page">
Expand Down
12 changes: 6 additions & 6 deletions src/pages/apis/pages/location/index/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* @Author: iChengbo
* @Date: 2021-08-03 18:55:14
* @LastEditors: iChengbo
* @LastEditTime: 2021-08-04 17:14:29
* @LastEditTime: 2021-08-17 11:35:32
* @FilePath: /taro-react-native/src/pages/apis/pages/location/index/index.tsx
*/
import Taro from '@tarojs/taro';
import { useState } from "react";
import { useCallback, useState } from "react";
import { View, Button } from '@tarojs/components';
import JSONTree from '../../../../components/jsontree';

Expand All @@ -17,15 +17,15 @@ const PageView = () => {
const [location1, setLocation1] = useState({});
const [location2, setLocation2] = useState({});

const _handleCallback1 = (res) => {
const _handleCallback1 = useCallback((res) => {
console.log("回调函数 C1", res);
setLocation1(res)
}
}, []);

const _handleCallback2 = (res) => {
const _handleCallback2 = useCallback((res) => {
console.log("回调函数 C2", res);
setLocation2(res)
}
}, []);

return (
<View className="api-page">
Expand Down
12 changes: 6 additions & 6 deletions src/pages/apis/pages/surface/keyboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
* @Author: iChengbo
* @Date: 2021-08-03 17:17:28
* @LastEditors: iChengbo
* @LastEditTime: 2021-08-03 17:59:01
* @LastEditTime: 2021-08-17 11:35:58
* @FilePath: /taro-react-native/src/pages/apis/pages/surface/keyboard/index.tsx
*/
import { useState } from 'react';
import { useCallback, useState } from 'react';
import Taro from '@tarojs/taro';
import { View, Button, Text, Input } from '@tarojs/components';

Expand All @@ -14,13 +14,13 @@ import './index.scss'
const PageView = () => {
const [value, setValue] = useState('');

const _handleCallback1 = (res) => {
const _handleCallback1 = useCallback((res) => {
console.log("回调函数 C1", res);
}
}, []);

const _handleCallback2 = (res) => {
const _handleCallback2 = useCallback((res) => {
console.log("回调函数 C2", res);
}
}, []);

return (
<View className="api-page">
Expand Down

0 comments on commit fdf79c1

Please sign in to comment.