小编Car*_*oga的帖子

在React-Native中制作指南针

我试图制作指南针,但我不知道如何使用磁力计的数据.

这是我的班级指南针:

class Compass extends Component {
  constructor(props) {
    super(props);
  }
  componentWillMount(){
    this._animeRotation = new Animated.Value(0);
  }
  componentDidMount() {
      this.startAnimation();
  }
  startAnimation() {
    Animated.timing(this._animeRotation, {
      toValue: this.props.magn, //<-- What put here?
      duration: 1000,
    }).start(() => {
      this.startAnimation();
    });
  }
  render() {
    var interpolatedRotateAnimation = this._animeRotation.interpolate({
      inputRange: [0, 100],
      outputRange: ['0deg', '360deg']
    });
    return (
      <View>
        <Animated.View style={[styles.box, {transform: [{rotate: interpolatedRotateAnimation}]}]}>
          <Image style={styles.box} source={require('./arrow.png')}></Image>
        </Animated.View>
      </View>
    );
  }
}
Run Code Online (Sandbox Code Playgroud)

这是类App:

class App extends Component {
  constructor(props) {
    super(props);
    this.state = { …
Run Code Online (Sandbox Code Playgroud)

javascript ecmascript-6 react-jsx react-native

5
推荐指数
1
解决办法
3017
查看次数

在 Android 中启用所有通知权限

至少在我安装我的应用程序时,在我的两部小米手机中,它没有像图片中那样的所有通知权限(只有振动、徽章和锁定屏幕)。

在此处输入图片说明

我可以在我的应用程序中做什么才能默认启用所有通知权限?

谢谢!

notifications android android-notifications

5
推荐指数
1
解决办法
6524
查看次数