Skip to content
This repository has been archived by the owner on Jan 7, 2019. It is now read-only.

Add standard: what differences between iOS and android should I be aware of #146

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

pleportz
Copy link
Contributor

No description provided.

@bam-bot-tech
Copy link

bam-bot-tech commented Jul 18, 2018

Fails
🚫

differences-between-ios-and-android.s.md: You failed to mention a Bad Examples

🚫

differences-between-ios-and-android.s.md: You failed to mention a Good Examples

Automatic reviewers

cc: @louiszawadzki, @tychota

Generated by 🚫 dangerJS

While coding I usually use the iOS simulator only. Most of the time, if the feature works on iOS then it works on android automatically. Of course there are a few exceptions: in this article you will find a non comprehensive list of caveats.


### I modified the native code
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check : il y a une différence de commit dans le dossier android ou dossier ios


- References: See [How to add a native module](https://github.com/bamlab/dev-standards/blob/master/react-native/setup/add-native-module.mo.md)

### I added a fixed height property to a component
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i set the dimensions (width or height) of a component

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ajouter un exemple avec un screenshot

shadowOpacity: 0.2,
shadowOffset: { height: 1, width: 1 },
elevation: 3,
backgroundColor: 'white', // <-- backgroundColor is mandatory for android
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

et des margin

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ajouter un exemple avec screenshot

Copy link
Contributor Author

@pleportz pleportz Jul 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

premier step :

shadowColor: 'grey',
shadowRadius: 10,
shadowOpacity: 0.2,
shadowOffset: { height: 1, width: 1 },

==> ne sont que pour ios

  • pour android :
    c'est elevation + backgroundcolor sur au moins un des composants qui contient le composant en question+ margin qui fait le travail

- Why: <TextInput /> does not render identically on android and iOS:

- With android you might need to specify the `underlineColorAndroid` prop (can be set to `"transparent"` for example)
- The vertical alignment of the input text is not the same. This can be solved by using a marginTop that depends on the platform: `marginTop: Platform.OS === 'ios ? ...'`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plutot mettre un padding: 0 sur le TextInput, sans distinction de plateforme

- With android you might need to specify the `underlineColorAndroid` prop (can be set to `"transparent"` for example)
- The vertical alignment of the input text is not the same. This can be solved by using a marginTop that depends on the platform: `marginTop: Platform.OS === 'ios ? ...'`

### I mistakenly added text direcly as a `<View />`'s child
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

directly


### I used a javascript function that is not implemented the same way in react-native's javascript interpreters for android and iOS

- Why: As of July 2018, react-native's javascript interpreter for android is a little bit late compared to iOS's. There are a few methods that just won't work with android:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few methods that just won't work with android (non comprehensive list):

@pleportz
Copy link
Contributor Author

pleportz commented Jul 19, 2018

  • fontweight pas interprété de la même manière (cf. ajout de fontweight: undefined)
  • Ajouter les lineHeight ? (à checker)
  • Faire une recherche sur "Platform." dans les projets BAM pour trouver d'autres exceptions (attention parfois c'est corrigé dans les nouvelles versions rn)
  • WebView : iOS 10 : cookies partagés entre webview et navigateur safari -> ce ne serait plus le cas sur iOS 11 ; vérifier pour android

@pleportz
Copy link
Contributor Author

Et dans les dépendances :

  • react-navigation : centrage de titre
  • taille du header
  • si on met header transparent avec react-navigation, il y a encore les shodow sur android (ajouter elevation 0)

@pleportz pleportz force-pushed the add-differences-android-ios branch from 0e49b06 to e77e45b Compare July 24, 2018 21:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants