Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Styling issues with TouchOpacity on web #286

Open
xyreryp opened this issue Nov 19, 2018 · 0 comments
Open

Styling issues with TouchOpacity on web #286

xyreryp opened this issue Nov 19, 2018 · 0 comments
Labels

Comments

@xyreryp
Copy link

xyreryp commented Nov 19, 2018

  • syr-cli version: latest
  • syr version: latest

Problem:

When customizing the style for TouchOpacity, it works on iOS but not web.

relevant code:

const styles = {
    squares: {
      width: PixelRatio.getPixelSizeForLayoutSize(610),
      height: PixelRatio.getPixelSizeForLayoutSize(610),
      borderColor: '#421794',
      
      borderWidth: PixelRatio.getPixelSizeForLayoutSize(10),
      left: (Dimensions.get("window").width / 2) - PixelRatio.getPixelSizeForLayoutSize(300), 
      top: (Dimensions.get("window").height / 2) - PixelRatio.getPixelSizeForLayoutSize(300),
    },
squareLocation: function(number) {
      const row = Math.floor(number / 3) - (number % 3 ? 0 : 1);
      const col = number % 3 ? number % 3 : 3; // 0, 1, 2
      const width = PixelRatio.getPixelSizeForLayoutSize(600) / 3;
      const height = PixelRatio.getPixelSizeForLayoutSize(600) / 3;
      const left = (col - 1) * width ;
      const top = row * height ;
      var borderLeftWidth =  PixelRatio.getPixelSizeForLayoutSize(3), borderRightWidth = PixelRatio.getPixelSizeForLayoutSize(3), borderBottomWidth = PixelRatio.getPixelSizeForLayoutSize(3), borderTopWidth =  PixelRatio.getPixelSizeForLayoutSize(3)
      if (number == 1 || number == 4 || number == 7) {
        borderLeftWidth = 0;
        borderTopWidth = 0;
      } else if (number == 3 || number == 6 || number == 9) {
        borderRightWidth = 0;
        borderTopWidth = 0;
      } else if (number == 2) {
          borderTopWidth = 0;
      }

      if (number == 7 || number == 8 || number == 9) {
        borderBottomWidth = 0
      }
      
      return {
        height: height,
        width: width,
        left: left,
        top: top,
        borderColor: '#253B80',
        borderLeftWidth: borderLeftWidth,
        borderRightWidth: borderRightWidth,
        borderBottomWidth: borderBottomWidth,
        borderTopWidth: borderTopWidth,
      };
    }
}
<View style={styles.squares}>
          <TouchableOpacity onPress={() => this.ontilePress(0,0)}  style={styles.squareLocation(1)}>
                {this.renderIcon(0,0)}
          </TouchableOpacity>
          <TouchableOpacity onPress={() => this.ontilePress(0,1)}  style={styles.squareLocation(2)}>
                {this.renderIcon(0,1)}
          </TouchableOpacity>
          <TouchableOpacity onPress={() => this.ontilePress(0,2)}  style={styles.squareLocation(3)}>
                {this.renderIcon(0,2)}
          </TouchableOpacity>
          <TouchableOpacity onPress={() => this.ontilePress(1,0)}  style={styles.squareLocation(4)}>
                {this.renderIcon(1,0)}
          </TouchableOpacity>
          <TouchableOpacity onPress={() => this.ontilePress(1,1)}  style={styles.squareLocation(5)}>
                {this.renderIcon(1,1)}
          </TouchableOpacity>
          <TouchableOpacity onPress={() => this.ontilePress(1,2)}  style={styles.squareLocation(6)}>
                {this.renderIcon(1,2)}
          </TouchableOpacity>
          <TouchableOpacity onPress={() => this.ontilePress(2,0)}  style={styles.squareLocation(7)}>
                {this.renderIcon(2,0)}
          </TouchableOpacity>
          <TouchableOpacity onPress={() => this.ontilePress(2,1)}  style={styles.squareLocation(8)}>
                {this.renderIcon(2,1)}
          </TouchableOpacity>
          <TouchableOpacity onPress={() => this.ontilePress(2,2)}  style={styles.squareLocation(9)}>
                {this.renderIcon(2,2)}
          </TouchableOpacity>
        </View>

Web verison:

screen shot 2018-11-19 at 12 31 14 pm

iOS version

screen shot 2018-11-19 at 12 30 39 pm

@dmikey dmikey added the bug label Nov 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants