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

Can anyone give me an example for bordershadow? #51

Open
changyu2hao opened this issue May 27, 2020 · 1 comment
Open

Can anyone give me an example for bordershadow? #51

changyu2hao opened this issue May 27, 2020 · 1 comment

Comments

@changyu2hao
Copy link

I want to implement the bordershadow, but don't know how. Please give me a example

@vanyasem
Copy link

Here is an example for you:

import React from 'react';
import {StyleSheet, View, Text, Dimensions} from 'react-native';
import {BorderShadow} from 'react-native-shadow';

export const Example = props => {
  const screenWidth = Math.round(Dimensions.get('window').width); //TODO: handle rotation
  const shadowOpt = {
    side: 'top',
    width: screenWidth,
    opacity: 0.07,
    border: 3.5,
    color: '#000',
    style: styles.container,
  };

  return (
    <BorderShadow setting={shadowOpt}>
      <View style={styles.row}>
        <Text>example</Text>
      </View>
      <View />
    </BorderShadow>
  ); // Second view is necessary due to a bug that prevents BorderShadow from working with non-array children
};

const styles = StyleSheet.create({
  container: {
    height: 40,
    backgroundColor: '#FFF',
  },
  row: {
    flex: 1,
    flexDirection: 'row',
    justifyContent: 'space-evenly',
    alignItems: 'center',
  },
});

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

2 participants