react-native-unity-view icon indicating copy to clipboard operation
react-native-unity-view copied to clipboard

Elements upside down when adding library - iOS only

Open chiechelski opened this issue 5 years ago • 24 comments

Hi there,

We couldn't find any solution or someone having a similar issue, so hopefully, you guys can help us out.

It seems that every time we include react-native-unity-view, link files and include the UnityExport files, the react native elements turn upside down. We can fix a few screens by adding flexDirection: "column", but that seems too odd to be happening only in iOS.

Here is an example of our screen before including the files

54522480_2373530955992721_2306688185763102720_n

And here is after

54268359_2371869396158877_5493648314186334208_n (1)

Any idea what to do?

chiechelski avatar Mar 21 '19 22:03 chiechelski

@chiechelski I'm running into this same issue on RN 0.59.0+. Does that match your version, and have you found a solution?

kevinsperrine avatar Mar 28 '19 02:03 kevinsperrine

Hey @kevinsperrine , Unfortunately not. But my workaround was to add flexDirection: 'column' to all my containers styles. And on the ScrollViews add to the contentContainerStyle. Eg.:

<ScrollView
  style={[styles.container]}
  contentContainerStyle={{ flexDirection:'column' }}
>

Let me know if you find anything. Cheers

chiechelski avatar Mar 28 '19 03:03 chiechelski

@chiechelski This is going to sound absolutely stupid, but are you using Pods in your project and are you doing a #include "Pods/Target Support Files/blah/blah.xcconfig" at the top of your UnityConfig.xcconfig files? If so, try moving the include to the bottom of the UnityConfig instead, clean the project, and try a rebuild.

kevinsperrine avatar Mar 29 '19 04:03 kevinsperrine

I've having the same issue with RN 0.59.0+, have you managed to fix it somehow?

fluiddot avatar Apr 26 '19 15:04 fluiddot

@fluiddot I managed to make it work by changing the pods file include as mentioned above. By combining the two configs (unity and pods) together I was able to make it work. I have no idea what part of the ordering or inclusion process is causing it, but that's what fixed it for me.

kevinsperrine avatar Apr 26 '19 15:04 kevinsperrine

It worked like charm! Thanks @kevinsperrine! I'm wondering what's the casing the issue...

fluiddot avatar Apr 29 '19 10:04 fluiddot

@kevinsperrine Hey, facing the same issue here. Have tried your suggestion and it seems not to work for me. Can you share your unity config file? Thanks.

FYI:

"react": "16.8.3"
"react-native": "0.59.9"

Deishelon avatar Jun 18 '19 20:06 Deishelon

@Deishelon

//  UnityConfig.xcconfig
//  rnunitydemo
//
//  Created by xzper on 2018/3/6.
//  Copyright © 2018年 Facebook. All rights reserved.
//

// Originally I was including my pods file here like so:
// #include "Pods/Target Support Files/Pods-aramis/Pods-aramis.release.xcconfig"
// However, when including it at the top of the config all of the elements were upside down,
// but if I moved it to the bottom after all of the unity declarations it works as expected... 🤷‍♂ 


UNITY_SCRIPTING_BACKEND = il2cpp;
GCC_PREFIX_HEADER = $(SRCROOT)/UnityExport/Classes/Prefix.pch;

HEADER_SEARCH_PATHS = $(inherited) "$(SRCROOT)/UnityExport/Classes" "$(SRCROOT)/UnityExport/Classes/Unity" "$(SRCROOT)/UnityExport/Classes/Native" "$(SRCROOT)/UnityExport/Libraries" "$(SRCROOT)/UnityExport/Libraries/libil2cpp/include" ${PODS_HEADER_PATHS};

LIBRARY_SEARCH_PATHS = $(inherited) "$(SRCROOT)/UnityExport/Libraries" "$(SRCROOT)/UnityExport/Libraries/libil2cpp/include" ${PODS_LIBRARY_PATHS};

// If using .net 4.0 in Unity, append -DNET_4_0 to OTHER_CFLAGS
OTHER_CFLAGS = $(inherited) -DINIT_SCRIPTING_BACKEND=1 -fno-strict-overflow -DRUNTIME_IL2CPP=1 -DNET_4_0;

OTHER_LDFLAGS = $(inherited) -weak-lSystem -weak_framework CoreMotion -weak_framework GameKit -weak_framework iAd -framework AVFoundation -framework AudioToolbox -framework CFNetwork -framework CoreGraphics -framework CoreLocation -framework CoreMedia -framework CoreVideo -framework Foundation -framework MediaPlayer -framework MediaToolbox -framework Metal -framework OpenAL -framework OpenGLES -framework QuartzCore -framework SystemConfiguration -framework UIKit -liconv.2 -liPhone-lib -lil2cpp ${PODS_LIBRARIES};

CLANG_CXX_LANGUAGE_STANDARD = c++0x;
CLANG_CXX_LIBRARY = libc++;
CLANG_ENABLE_MODULES = NO;
CLANG_WARN_BOOL_CONVERSION = NO;
CLANG_WARN_CONSTANT_CONVERSION = NO;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES;
CLANG_WARN_EMPTY_BODY = NO;
CLANG_WARN_ENUM_CONVERSION = NO;
CLANG_WARN_INT_CONVERSION = NO;
CLANG_WARN_OBJC_ROOT_CLASS = YES;
CLANG_WARN_UNREACHABLE_CODE = NO;
CLANG_WARN__DUPLICATE_METHOD_MATCH = NO;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_ENABLE_OBJC_EXCEPTIONS = NO;
GCC_ENABLE_CPP_RTTI = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_THUMB_SUPPORT = NO;
GCC_USE_INDIRECT_FUNCTION_CALLS = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION[arch=*64] = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = NO;
GCC_WARN_UNINITIALIZED_AUTOS = NO;
GCC_WARN_UNUSED_FUNCTION = NO;

ENABLE_BITCODE = NO;

DEAD_CODE_STRIPPING = YES;

// Moved the pods include to the bottom and it works...
#include "Pods/Target Support Files/Pods-aramis/Pods-aramis.release.xcconfig"

kevinsperrine avatar Jun 19 '19 16:06 kevinsperrine

I've having the same issue with RN 0.59.9. but I Not using this extension, my situation is after my main project (Unity3D) integrates React-Native. Elements upside down. I don't know how this happened. Please help...

not in Unity3D project:

61943356-d187b880-afcd-11e9-95c0-d908ac626cc6

Unity3D project:

61943371-d8163000-afcd-11e9-8a5c-cd77d7619be3

HotWordland avatar Jul 27 '19 07:07 HotWordland

@HotWordland Hey, make sure in your .xcconfig file you add Unity paths first

i.e:

HEADER_SEARCH_PATHS = $(inherited) "$(SRCROOT)/UnityExport/Classes" "$(SRCROOT)/UnityExport/Classes/Unity" "$(SRCROOT)/UnityExport/Classes/Native" "$(SRCROOT)/UnityExport/Libraries" "$(SRCROOT)/UnityExport/Libraries/libil2cpp/include" (.... your other paths)

LIBRARY_SEARCH_PATHS = $(inherited) "$(SRCROOT)/UnityExport/Libraries" "$(SRCROOT)/UnityExport/Libraries/NatCorder/Plugins/iOS" "$(SRCROOT)/UnityExport/Libraries/libil2cpp/include" (.... your other paths)

Deishelon avatar Jul 27 '19 09:07 Deishelon

@Deishelon thanks , but I don't have it . xcconfig file . My project is Unity3D. I didn't integrate react-native before. After integration, I found that the page elements written with react-native are upside down.

QQ20190727-185538@2x

HotWordland avatar Jul 27 '19 11:07 HotWordland

@HotWordland You gotta have a custom UnityConfig.xcconfig -> https://github.com/f111fei/react-native-unity-demo/blob/master/ios/rnunitydemo/UnityConfig.xcconfig

Alternatively, you can temporarily modify *.xcconfig in Pods folder, but it will be overridden next time you do a pod install

Deishelon avatar Jul 27 '19 20:07 Deishelon

@Deishelon It's work for me great ! thanks . 👍

HotWordland avatar Jul 28 '19 07:07 HotWordland

@HotWordland 我有和你一样的问题,方便聊一下吗,我也是unity导出的项目,通过node_modules集成到iOS里, "react": "^17.0.1", "react-native": "0.63.3", 我也没有UnityConfig.xcconfig文件,不知道怎么处理了,希望能帮我解答一下。 6CDFDBE3-A1A1-4731-8257-8C17F3A81A77

jiangjiatao avatar Mar 18 '21 13:03 jiangjiatao

@kevinsperrine @Deishelon I don't have . xcconfig file , but i have a custom UnityConfig.xcconfig,and moved the pods include to the bottom But it's useless,Can you give me some help,i use cocoapods , "react": "^17.0.1", "react-native": "0.63.3" 070DCD3B-B91E-4D55-8F31-0109757ACE37

jiangjiatao avatar Mar 19 '21 07:03 jiangjiatao

@HotWordland 我有和你一样的问题,方便聊一下吗,我也是unity导出的项目,通过node_modules集成到iOS里, "react": "^17.0.1", "react-native": "0.63.3", 我也没有UnityConfig.xcconfig文件,不知道怎么处理了,希望能帮我解答一下。 6CDFDBE3-A1A1-4731-8257-8C17F3A81A77

我记得 把 UnityConfig.xcconfig 这个文件加到主项目的根路径就可以了... 没有的话 看这个 https://github.com/f111fei/react-native-unity-demo/blob/master/ios/rnunitydemo/UnityConfig.xcconfig 创建一个就可以了 这里记录了一下 http://codercq.com/d/25 另外我的rn版本是 0.59

HotWordland avatar Mar 23 '21 01:03 HotWordland

@HotWordland 我在根目录添加了,但是不行,你看看,我加的有问题吗 669924DF-1090-4A00-83FA-EE457E7458A5

jiangjiatao avatar Mar 23 '21 02:03 jiangjiatao

@HotWordland 我在根目录添加了,但是不行,你看看,我加的有问题吗 669924DF-1090-4A00-83FA-EE457E7458A5

不用 直接 文件名 叫 UnityConfig.xcconfig 然后拖入主项目里面就行 你试一下

HotWordland avatar Mar 23 '21 02:03 HotWordland

@HotWordland 我试过,还是不行,我的pods文件有很多个,我在下面include哪一个,我的unity.xcconfig里应该写什么内容,我是直接把我的pods.coconfig里的内容,直接复制过来的,这样对吗?还有就是unity.xcconfig就是单纯拖到工程里,什么都不需要做吗?困扰我很久了,麻烦你了。 A1615526-C305-4450-B410-C01494460E04

jiangjiatao avatar Mar 23 '21 03:03 jiangjiatao

@HotWordland 我试过,还是不行,我的pods文件有很多个,我在下面include哪一个,我的unity.xcconfig里应该写什么内容,我是直接把我的pods.coconfig里的内容,直接复制过来的,这样对吗?还有就是unity.xcconfig就是单纯拖到工程里,什么都不需要做吗?困扰我很久了,麻烦你了。 A1615526-C305-4450-B410-C01494460E04

引用一下其他项目的 : 你试试看看 img

HotWordland avatar Mar 23 '21 03:03 HotWordland

@HotWordland 我是这样的,导出unity的iOS项目,然后把这个项目集成cocoapods,通过cocoapods再集成react-native的环境,再把react-native打包成iOS用的jsbundle,jsbundle放到unity导出的iOS项目里,然后写相关代码调用jsbundle,加载到unity的UnityAppController上,做展示。

jiangjiatao avatar Mar 23 '21 06:03 jiangjiatao

@HotWordland 我是这样的,导出unity的iOS项目,然后把这个项目集成cocoapods,通过cocoapods再集成react-native的环境,再把react-native打包成iOS用的jsbundle,jsbundle放到unity导出的iOS项目里,然后写相关代码调用jsbundle,加载到unity的UnityAppController上,做展示。

你看下 第4步 项目里面有没有配置选中 UnityConfig.xcconfig

HotWordland avatar Mar 23 '21 06:03 HotWordland

@HotWordland 我配置了,我想问一下,在UnityConfig.xcconfig,我应该写什么东西,是直接把你给的链接里的内容直接复制过来就可以吗?你看看我写的对吗 39DC04B1-FE9A-4387-9C51-8D7A6A1CC7EF

jiangjiatao avatar Mar 23 '21 06:03 jiangjiatao

@HotWordland 我的qq号:937840988,方便加个qq聊一下吗,我这卡好久了,一直没搞出来,希望能帮我看看

jiangjiatao avatar Mar 23 '21 06:03 jiangjiatao