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

Option to style container #45

Open
ritz078 opened this issue Nov 15, 2017 · 6 comments
Open

Option to style container #45

ritz078 opened this issue Nov 15, 2017 · 6 comments

Comments

@ritz078
Copy link

ritz078 commented Nov 15, 2017

I need to update the style of this

Or maybe use an array instead of a wrapper.
Con: Only supported in React 16.

@gs-akhan
Copy link
Owner

gs-akhan commented Nov 15, 2017 via email

@ritz078
Copy link
Author

ritz078 commented Nov 15, 2017

Solution 1

accept a single style with different keys for different sections

const styles = {
  container: {},
  dropdown: {},
  textStyle: {}
}

and then use it

<View style={[style.default, styles.container]}></View>

Con : This will be a breaking change

Alternative solution:
Just add another style property. containerStyle

2nd Way

remove the container as React 16 supports arrays

return [
      <TouchableWithoutFeedback key="press" onPress={this.onPress.bind(this)}>
          <View style={[styles.selectBox, style]}>
            <View style={styles.selectBoxContent}>
              <Text style={textStyle}>{this.state.defaultText}</Text>
              <Indicator
                direction={indicator}
                color={indicatorColor}
                size={indicatorSize}
                style={indicatorStyle}
              />
            </View>
          </View>
        </TouchableWithoutFeedback>,

        <Modal
          key={"modal"}
          transparent={transparent}
          animationType={animationType}
          visible={this.state.modalVisible}
          onRequestClose={this.onClose.bind(this)}
          supportedOrientations={['portrait', 'portrait-upside-down', 'landscape', 'landscape-left', 'landscape-right']}
        >
          <TouchableWithoutFeedback onPress={this.onModalPress.bind(this)}>
            <View style={[styles.modalOverlay, backdropStyle]}>
              <OptionList
                onSelect={this.onSelect.bind(this)}
                selectedStyle={selectedStyle}
                selected={selected}
                style={[optionListStyle]}
              >
                {this.props.children}
              </OptionList>
            </View>
          </TouchableWithoutFeedback>

        </Modal>]

@st0ffern
Copy link
Collaborator

this is possible in v2

@ritz078
Copy link
Author

ritz078 commented Nov 16, 2017

Alternative solution:
Just add another style property. containerStyle

I think this can be implemented now ?

@gs-akhan
Copy link
Owner

gs-akhan commented Nov 16, 2017 via email

@Pfurr
Copy link

Pfurr commented Dec 29, 2017

hi guys, can you give an example of how to use indicatorColor and indicatorSize? Here my code:

render() { return ( <View style={styles.container}> <Select onSelect={this.onSelect.bind(this)} defaultText={this.state.value} style={{ width: 180, height: 50, borderWidth: 4, borderRadius: 6, backgroundColor: "red", borderColor: "white", justifyContent: "center", alignItems: "center" }} textStyle={{ fontSize: 18, fontStyle: "italic", color: "white", justifyContent: "center" }} backdropStyle={{ backgroundColor: "#845321" }} optionListStyle={{ backgroundColor: "#b78654", alignSelf: "center", justifyContent: "center", alignItems: "center", width: 300, height: 150, borderWidth: 4, borderRadius: 6, borderColor: "white" }} styleText={{ color: "green" }} > <Option value="1">1</Option> <Option value="2">2</Option> </Select> </View> ); } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants