简体   繁体   English

从android迁移到ios react-native

[英]Moving from android to ios react-native

I have an app completed using Android and react-native and I am starting to work on the ios version with react-native. 我有一个使用Android和react-native完成的应用程序,并且我开始使用react-native在ios版本上工作。 Are there going to be any new road blocks with this change? 这项变更会不会有新的障碍? And is it most likely that I should be able to reuse most - if not all of my react-native code while working on the ios version, Cheers. 而且最有可能应该重用大多数-如果不是所有的react-native代码,则在ios版本Cheers上工作时。

Yes you can reuse most of your js code. 是的,您可以重用大多数js代码。 If you are using native libraries you will have to run "react-native link" to link with the native code. 如果使用的是本机库,则必须运行“ react-native link”以与本机代码链接。

Well, the main purpose of react-native is to write "Almost" the same code which for both platforms. 好吧,react-native的主要目的是为两个平台编写“几乎”相同的代码。 However, there are probably going to be several differences in the way, including: 但是,在方式上可能会有一些差异,包括:

  1. StatusBar 状态栏

It is probably going to be the first thing that you notice. 您可能会注意到这是第一件事。 In Android, you do not need to handle the status bar and the app automatically starts below the status bar, However in IOS, the app starts from the top of the screen, and you will probably see the time and battery in the middle of your header. 在Android中,您不需要处理状态栏,该应用程序会自动在状态栏下方启动,但是在IOS中,该应用程序从屏幕顶部启动,并且您可能会在中间看到时间和电池标头。 you probably need to give a paddingTop to your header or use, "StatusBar" Module from react-native to handle this issue. 您可能需要给标题添加paddingTop或使用react-native的“ StatusBar”模块来处理此问题。

https://facebook.github.io/react-native/releases/0.31/docs/statusbar.html https://facebook.github.io/react-native/releases/0.31/docs/statusbar.html

  1. Shadow and Elevation 阴影和高程

As you might have noticed, there are some shadow stylings, which do not have any effect on the shape and appearance of your components. 您可能已经注意到,有些阴影样式对组件的形状和外观没有任何影响。 In Android devices "Elevation" is used to make an illusion of 3d Effects on layers. 在Android设备中,“海拔”用于在图层上产生3d效果的错觉。 However, in IOS you need to use shadow properties such as, shadow radius, shadow color and ... to make a good looking component. 但是,在IOS中,您需要使用阴影属性(例如阴影半径,阴影颜色和...)来制作美观的组件。

https://facebook.github.io/react-native/docs/shadow-props.html https://facebook.github.io/react-native/docs/shadow-props.html

  1. UI-UX Design UI-UX设计

There are some structural differences between Android and IOS platforms, which will result in a slight (or sometimes major) UI-UX differences. Android和IOS平台之间存在一些结构差异,这将导致轻微(或有时是重大的)UI-UX差异。

  • For example, there is no physical back button in iPhones. 例如,iPhone中没有物理后退按钮。 As a result, you cannot rely on a physical back button and you need to put a go back button on every page. 结果,您不能依靠物理的后退按钮,而需要在每个页面上放置一个后退按钮。

  • Additionally, generally speaking, IOS apps do not have a drawer, and you need to think about this. 另外,通常来说,IOS应用程序没有抽屉,您需要考虑一下。

  • Several modules are built specifically for one platform, such as datepickerios. 为一个平台专门构建了多个模块,例如datepickerios。 The original picker in IOS platform is a smooth wheelpicker, and the datepicker is also different with android, so u have to have these modules in mind. IOS平台中的原始选择器是一个平滑的Wheelpicker,而datepicker与android也有所不同,因此您必须牢记这些模块。

  • Moreover, if you installed any other npm modules, check their github page to see, if there is any special guide on linking and usage in different platforms 此外,如果您安装了其他npm模块,请查看其github页面以查看是否有关于在不同平台上进行链接和使用的特殊指南。

Ps. 附言 I think it is better to take a look at the app and check for possible bugs, then try to have on eye on API sections in the react-native web page for platform specific codes. 我认为最好查看一下该应用程序并检查可能的错误,然后尝试着眼于react-native网页中的API部分以获取平台特定的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在现有的 React Native iOS 项目中安装 React-Native Android? - Installing React-Native Android in existing React Native iOS project? 从我的 react-native 应用程序调用 UPI 应用程序在 iOS 中有效,但在 Android 中无效 - Invoking UPI apps from my react-native App works in iOS but not in Android 如何在 react-native 上为 android 和 ios 使用不同的样式? - How to use different styles for android and ios on react-native? 在 react-native 中为 ios 和 android 平台处理的常见事情是什么? - What is common thing to handle for ios and android platform in react-native? React-Native:无法重新创建 Android 和 iOS 文件夹 - React-Native: Unable to recreate Android & iOS Folders 如何在 react-native 应用程序中打开网站(Android 和 iOS) - How to open an website inside the react-native app(Android and iOS) React-native Axios 在 iOS 中工作但在 Android 中不调用 - React-native Axios is working in iOS but not calling in Android 将iOS转换为Android时,React-Native Element类型无效 - React-Native Element type is invalid when converting IOS to Android React-Native 更改 iOS 和 Android 文件夹的默认位置 - React-Native change default location of iOS and Android folder 适用于React-Native应用程序的iOS / Android应用程序文件夹结构 - iOS/ Android app folder structure for React-Native app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM