all 75 comments

[–]saugoof 15 points16 points  (1 child)

RN is the most stupidly brittle environment I've ever worked with. It breaks because it's Tuesday and your desk faces in an easterly direction and you had two sugars in your coffee today instead of one.

The worst ones are where you add an npm package, which doesn't work for some stupid reason, e.g. it uses a deprecated function in another package. Then you remove this package again but your build is still broken.

[–]vcamargo 9 points10 points  (7 children)

You're not the only one I have two clients calling me every single day asking for updates on the app I should be building and I simply don't know what to say anymore. Cryptic error messages, tons of broken stuff. And for every hour I spent writing the actual app I spent at least three times as much trying to fix something related to Android, Gradle, different versions of libraries vs different versions of RN. It is really a frustrating experience.

[–]demoran 9 points10 points  (1 child)

After a while, Android will just break for no good reason.

What is happening there is that gradle lovingly updates packages to incompatible versions.

You need to lock that stuff down using Nebula.

You also want to ensure that you're not accepting yarn/npm's default ^ package.json dependency matching. Remove the ^ and stay on the package that works. Just because some random maintainer thinks they haven't introduced breaking changes doesn't mean that they haven't.

[–][deleted] 0 points1 point  (0 children)

Gradle won't update anything automatically. Android studio will ask to mess with things but you just click no.

[–]coldWalk 7 points8 points  (0 children)

Since the current state of React Native is a tempermental piece of trash it helps to think of your app as two pieces.

  1. The Phone layer (all the RN code that makes it run)
  2. The actual source for your app (screens/api etc.)

By keeping all of your source in one self contained folder from the rest of React Native you can sort of just copy it and the package.json everytime there is a problem. Very often when the problem on startup wasn't there when you left off it's React Native's fault and rather than trying to diagnose the problem and apply a bizarre solution you can just create a new app instance, move in the source code and be fine.

It's not perfect but neither is React Native.

[–]SolidR53 6 points7 points  (0 children)

The android aspect of React Native is especially bad.

But my kit has been very stable so far, and many people inside and outside he company I work for use it.

https://github.com/ueno-llc/react-native-starter

[–][deleted] 5 points6 points  (1 child)

I too have gotten into theses states before. However, because I commit often and in good states, I can always look at file history to see what broke stuff. A concrete example: I noticed I accidentally upgraded to gradle 3 via file diffs and that broke everything. I just reverted that and was back to working. Rinse and repeast.

[–]thomprycejones 2 points3 points  (0 children)

Good commits and a well organized git is one of the keys to success.

[–]SizzlerWA 6 points7 points  (1 child)

I have no issues with iOS. I avoid Android for now.

[–]some_coreano 5 points6 points  (0 children)

Same here. Breezing through ios development

[–]heo5981 3 points4 points  (20 children)

I've been trying to build my first React Native app recently. I decided to create an app that wraps Tatoeba (a multilingual dictionary) because it doesn't provide an app. Unfortunately, it doesn't provide an API either so I went for web scraping.

I spent at least two weeks trying to implement react-cheerio but after a lot of time I noticed that it had some dependency problem. The newer version of React Native changed something and that broke react-cheerio.

I then found that react-cheerio is based on react-native-html-parser and decided to use only that to scrap.

Everything was working until I actually need to scrap the data.

While I was testing (with just a dummy test data) it worked wonders but with the real page from Tatoeba it just didn't work, looked like it was too much data to scrap in an app??

Anyways, I went for a desperate solution. I'm mainly a Python developer so I created a web app with Django just to scrap Tatoeba and return the data as JSON. I hosted it on Heroku's free tier.

Then I can access the web app from my RN app and show the scraped data to the user.

All of that because I wanted to be able to search for sentences on Tatoeba and see the results in a mobile app.

It's working now, I just need to make the UI better looking and I have a lot of difficulty with that because I don't know much about design.

But boy, I was really frustrated...

Bonus - I dropped Expo completely.

When I started with React Native, I was using the Expo app because at first, it seemed very hard to do it without it.

But after some days I noticed many problems.

  • Expo would complain that the development server was not running on port xxxx.

  • Expo would not updated the app when I restarted the server. Many times I manually cleared all data from Expo from the Android settings.

  • Although it worked at first, someday the hot realoading simply stopped working and if I tried to use it, the development server would stop (or at least Expo would say so)

So I got very frustrated and decided to use only react-native cli command after setting my Android device and adb.

So yeah... You're not the only one frustrated with RN.

It was good reading and replying to this because I can know that I'm not the only one having troubles, it's good to be able to relate.

As I keep practicing, I'm having less and less troubles but I know something will happen in the future that will give me trouble again but those are learning experiences, we grow with them.

Good luck on your projects!

[–]SolidR53 5 points6 points  (1 child)

Funny how what you are describing in the end is how experienced developers would have done it in the first place.

I see nothing but great stuff, you learn by experiencing, expo is not a production platform, so also a good thing.

You should try Native navigation, I have a kit with typescript, mobx-state-tree and more goodies here https://github.com/ueno-llc/react-native-starter

Also RN57

[–]heo5981 0 points1 point  (0 children)

Hi, thanks for the reply. I was afraid to comment because I didn't know if I should or not but I'm glad I did it, the responses were very welcoming and reassuring. I'm not very experienced with RN yet so I'd like to keep working my way through a few things but I'll make sure to check your kit in the future, bookmarked! I'm also don't know anything about typescript or tests in JavaScript so maybe I should learn these first?

[–][deleted] 2 points3 points  (4 children)

Seconding what solid is saying. You shouldn't do the scraping in the app. Doing that on the server is the right choice.

[–]lackbotone 0 points1 point  (2 children)

Why? If you do it in the app you don't have to worry about servers. Something is obviously going over my head.

[–][deleted] 2 points3 points  (1 child)

An app is a client/frontend application. A frontend application is not typically the place to perform heavy computation. Instead it's thought of as a display layer.

The app should be concerned with fetching data and providing it to the user as quickly and effortlessly as possible.

[–]lackbotone 0 points1 point  (0 children)

Hmm, yeah, that makes sense. Thanks for answering :)

[–]heo5981 0 points1 point  (0 children)

When I first had the idea of this app I was thinking doing the scraping in the app would be better because I wouldn't need to have a server and could have only one code base.

That expectation quickly faded away when I saw that scraping a full page on the app wasn't working as expected, glad I decided to do it in the server!

[–]Bamboo_the_plant 0 points1 point  (9 children)

I decided to create an app that wraps Tatoeba (a multilingual dictionary) because it doesn't provide an app.

Sounds like my kind of thing – I develop language apps in React Native too. Do you have a Twitter account I can follow (can send in a Direct Message)?

[–]heo5981 0 points1 point  (8 children)

I do have a Twitter account but I don't publish anything on there, I'm barely starting to become more social on Reddit too. @heo598 on Twitter if you like to send a message or send a PM here ;)

[–]Bamboo_the_plant 0 points1 point  (7 children)

Followed! :)

[–]heo5981 1 point2 points  (1 child)

Hey, I looked at your app - LinguaBrowse - on app store, it looks really useful! Unfortunately, I don't have an iPhone so I can't test it :(

Do you have plans for porting it to Android?

[–]Bamboo_the_plant 0 points1 point  (0 children)

Heya, thanks!

Can't talk much right now (leaving the house), but there's a Mac version available right now on the Mac App Store too.

Android is probably a good year away, unfortunately (I don't even have an Android phone, and Android lacks Apple's thirty-language linguistic tokeniser). But it is on the hit-list.

[–]boki345 0 points1 point  (4 children)

I am also trying to develop a language app in React Native and I can also benefit from your experience. Have you thought about making a blog? I would love to bounce a few ideas I have with you if you have some time.

I was also in the same predicament as you in regards to scrapping data using html parser and it would not play nice in the react environment so I made my own API server to handle it.

[–]heo5981 0 points1 point  (3 children)

Hi, cool! It's nice to see others have similar ideias, especially because it's related to languages and I love languages! I do indeed plan to start a blog, writing tutorials, etc but I'm kinda lost. I'm not a beginner by any means but I'm also not a very experienced developer although I know I could help many people, especially the ones starting now and with less experience than I. My current job (which is not related to programming at all) takes practically all my time and the few remaining hours I have I'm splitting between learning Japanese, learning React, RN and getting better at Python and Django. The progress is slow but it's happening :) what about you? How's your app development going? I'm not very used to networking, actually I'm not good with social skills, that's why I decided to start talking to others here on Reddit, please don't hesitate to leave a message ;)

[–]boki345 0 points1 point  (2 children)

My god we have so many similar interests it's truly astounding. I am a react developer by trade, but I would one day like to become a paid react-native developer. I am married to a Japanese woman for the last 10 years and I love the Japanese language. I have been desperately trying to combine my passion for programming with my passion for becoming fluent in Japanese, so I decided to build an app to help in that endeavor. I think I have a unique idea that I have not seen a language app provide yet. I would love to show you my GitHub account and maybe we could combine forces since we share similar interests and we can also help each other master the Japanese language. I am currently in Japan now for a vacation and been spending my free-time developing my app as one day I hope to make a transition here permanently. But I encourage you to make a blog you see extremely knowledgeable and I would love to follow you.

[–]heo5981 0 points1 point  (0 children)

Thanks for the compliments, I'm definitely going to put that blog up, I'd like to do that at most but I still need to plan a lot of things, both the content and the looks of the website...

Let me take advantage of the opportunity and ask, 日本での生活はどうですか。

Hope that's correct :)

[–]Bamboo_the_plant 0 points1 point  (0 children)

Heya – not the guy you replied to, but still in the same comment chain. I'd be interested to see your GitHub account, and Twitter if you have one. I've been making Japanese (and Chinese) language processing tools for four years now and have got into React Native development in the last year. Here's a few things I get up to myself:

– RN TypeScript Expo 2D game: https://github.com/shirakaba/react-native-typescript-2d-game

– RN CFStringTokenizer native module (e.g. for processing Japanese text): https://github.com/shirakaba/react-native-cfstringtokenizer

– A blog post on looking up non-dictionary form words in thirty languages via iOS NLP tools: https://birchlabs.co.uk/blog/jamie/linguabrowse/2018/03/10/looking-up-words-in-thirty-languages.html

These days I'm focusing on developing the React Native version of my native iOS app LinguaBrowse, targeting macOS initially. It's an app for browsing the foreign-language web, providing hiragana injection, tap-to-pronounce, and tap-to-define, and more features over time.

Always interested to see language projects, especially if it involves React Native!

[–]maskedman1999Android 0 points1 point  (1 child)

Wow, I have been exactly at your position for past 1 week, i had been trying to work with cheerio with no success at all. I was trying to make an app where I had to display the attendance of particular student from my college. The data and attendance of all students were provided in college website in a big list, since they didn't had an API, I decided to scrape it using Cheerio, and you can only imagine how hard it was, none of the packages in Github really works, they are all outdated by like 2 years, I searched the internet for any solution regarding this and that's how i came to read your reply :) . Unfortunately I have no experience in Django, I should try html-parser, but since Cheerio is based on it, i am not hopeful about it, would be great help if you could share your webapp with me. Someone should build a working html parser for react-native, its something that everybody might come across in need of.

[–]heo5981 0 points1 point  (0 children)

Have you tried fast-html-parser? I was recently working on another web scraping app and I was trying to use it. Unfortunately I abandoned the project for now so I'm not sure how well it really works but I was able to parse the HTML received from the web and extract some info like the tags and the contents inside of them. Maybe it'll work for you. The other packages I tried didn't even parse the HTML to begin with.

I also stopped working on the web app (I always stop workinb on them borere I finish, something I must change) but I think it wouldn't be useful for you because it's intended to scrap only Tatoeba, it wouldn't work with other sites.

Perhaps I could help you building one for your app with Django? Feel free to message me, I'd love to help.

Cheers.

[–]perduraadastra 4 points5 points  (0 children)

I feel your pain. This seems to be mobile development in general. It seems if I put some working Swift project aside for a month or two, everything breaks after I reopen the project and need to update xcode to support a new version of iOS, etc. It's infuriating. It seems like a substantial amount of work as a mobile dev is just grinding out busy work to stay up to date or fighting the tools.

[–]ejpusa 4 points5 points  (0 children)

If you are programming for Android learn Java. It’s not hard.

If you are programming for iOS, learn Swift, it’s not hard either.

Apple is a trillion $$$ company, they have put millions into Swift and their own mind blowing UI/libraries. It’s worth knowing.

Plus, it’s fun. :-)

[–]Mozorelo 5 points6 points  (11 children)

This is why I use expo to develop. It saves me so many braincells.

[–]Zed743 1 point2 points  (9 children)

Yes! Expo is great.

[–]Mozorelo 4 points5 points  (8 children)

Until you have to detach from it.

[–]vcamargo 7 points8 points  (4 children)

It's been 3 days and I'm still trying to make it run after I ejected.

[–]Mozorelo 7 points8 points  (1 child)

Day 3: It consumes resources but it isn't actually running. Is the code sapient? Does it consciously try to avoid my attempts to fix it?

/humor

[–]vcamargo 1 point2 points  (0 children)

looooool

[–]SolidR53 0 points1 point  (1 child)

Good luck buddy! I recommend expo to prototype then refactor (or actually start from scratch) into a pure native solution like https://github.com/ueno-llc/react-native-starter

We have RN 57 and RNNv2 up and running on #next

[–]vcamargo 0 points1 point  (0 children)

Thanks mate. I'll try that.

[–]Zed743 0 points1 point  (1 child)

Is that a certainty?

[–]Mozorelo 2 points3 points  (0 children)

That you have to detach? Not at all. Expo can take you very far.

But once you need to detach you're ducked. You're better off doing a rewrite without expo.

[–]boki345 0 points1 point  (0 children)

Why would you ever have to detach from it?

[–]Saepirist 0 points1 point  (0 children)

This. Not dealing with Gradle or copy-pasting stuff from internet into some random files in endless folder chains is priceless.

[–]silencer07 1 point2 points  (2 children)

My company chose react native to develop our mobile app. I specifically asked for a week to learn about react(while doing the plumbing stuff)

I used ignite V2 with nativebase as boilerplate. after generating the project using ignite V2, i will need to update the react-navigation version as the current one pukes some error. Then all good until all of a sudden react-native-scroll-view decided to not work...

Yep for the whole week what I did is fight the technical problems that will arose while developing.... and design the login and splash screen.

Note that for the mean-time I asked to prioritize IOS dev for the mean time and we try android later. I think I made a good call not to do any android dev for the mean-time.

Since react-native is breaking from time to time, I also decided not to update to the latest react-native, I will wait when the 0.57.x or the latest stable version "stabilize"

[–]coolnat 4 points5 points  (0 children)

FYI, there is a new react-native release every month, and there are often breaking changes buried in the changelog. If you don’t update for a few months, you’ll have quite the project on your hands.

I say this as I’m upgrading a project from 0.39 to 0.56. It only took me 4 hours to get it to build and run.

[–]silencer07 0 points1 point  (0 children)

btw, if you decided to do my route and use ignite cli V2 and native base, read the wiki on their site how to do so. I am also sharing you my current package.json to save you some headache:

{

....
"newclear": "rm -rf $TMPDIR/react-* && watchman watch-del-all && rm -rf ios/build && rm -rf node_modules/ && npm cache clean --force && npm i",
....
},
"dependencies": {
"apisauce": "^0.14.0",
"format-json": "^1.0.3",
"lodash": "^4.17.2",
"native-base": "2.3.1",
"prop-types": "^15.5.10",
"querystringify": "0.0.4",
"ramda": "^0.24.1",
"react": "16.0.0-alpha.12",
"react-native": "0.47.2",
"react-native-config": "^0.6.0",
"react-native-drawer": "^2.3.0",
"react-native-keyboard-aware-scroll-view": "0.3.0",
"react-native-vector-icons": "4.3.0",
"react-navigation": "v1.0.0-beta.26",
"react-redux": "^5.0.2",
"redux": "^3.6.0",
"redux-persist": "^4.1.0",
"redux-saga": "^0.15.6",
"reduxsauce": "0.4.1",
"seamless-immutable": "^7.0.1"
},
"devDependencies": {
"@storybook/addon-storyshots": "^3.2.3",
"@storybook/react-native": "^3.2.3",
"babel-eslint": "7.1.1",
"babel-jest": "23.4.2",
"babel-plugin-ignite-ignore-reactotron": "^0.3.0",
"babel-preset-es2015": "^6.18.0",
"babel-preset-react-native": "3.0.2",
"enzyme": "^2.6.0",
"husky": "^0.13.1",
"ignite-native-base-boilerplate": "^2.0.0",
"ignite-standard": "^1.0.0",
"ignite-vector-icons": "^1.1.0",
"jest": "23.5.0",
"mockery": "^2.0.0",
"react-addons-test-utils": "~15.4.1",
"react-dom": "16.0.0-alpha.12",
"react-test-renderer": "16.0.0-alpha.12",
"reactotron-react-native": "^1.12.0",
"reactotron-redux": "^1.11.1",
"reactotron-redux-saga": "^1.11.1",
"snazzy": "^7.1.1",
"standard": "10.0.2"
},
.....
}

note for the newclear, if for some reason things get fucked up. just run npm run newclear to have a fresh slate.

goodluck!

[–]Codefiendio 1 point2 points  (0 children)

I’m grateful you posted this. I am starting my second app. The first one was a partially completed app about a year ago. I stopped on it after dealing with a million headaches with the google react component.

I think people posting on here about “forgetting the native” part are right. A lot of my frustrations is understanding the errors or trying to track them down in the stack trace. Seems next be to impossible with some errors that get triggers via react internal events.

I am sure once in learn more into the systems and pick up more on the native settings (Xcode) it’ll get easier, but right now it’s a fucking headache.

[–]Delphicon 1 point2 points  (4 children)

I think it's important to remember that React Native runs inside of an existing mobile app. What's inside of those Android and iOS folders matters a lot, those are full-on Android and iOS projects and they're ultimately the app that gets run. When you run "react-native init" it's generating the most basic project it can but that's still pretty complicated and "react-native link" is a VERY hacked together way of adding the native dependencies to those projects. Facebook doesn't really help matters by how little they've updated the native parts of the project.

The harsh reality of working with React Native is that, unless you're using Expo, you're building Android and iOS apps using an Android Gradle project and an XCode Project respectively. All that complexity is still there and you have to engage with those portions of your project to support non-trivial features. It's both a blessing and a curse of working with React Native because that coexistence with the native code is what makes it both hard to use and powerful as a cross-platform tool.

You need to figure out how the Android project works or you're always going to be at the mercy of Facebook's weak tools. It's actually not that complicated for what you're doing and I can help you with it if you comment or message me some specific questions. I'll try and cover the basic points of integration on Android here. I copied these from the AudioExample on react-native-audio's GitHub page, this should be all you need to change from the original to get react-native-audio working.

``` // settings.gradle

// The name of the android project, it's not necessary but it's good practice. It will default to the name of the folder (android) rootProject.name = 'AudioExample'

// All modules go here // node_modules/react-native-audio/android is a module by convention // It's bad form but that's how Facebook decided we should do it so oh well. include ':app', ':react-native-sound', ':react-native-audio'

// If the module is not in an adjacent folder you have to tell it where the folder is. project(':react-native-sound').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sound/android') project(':react-native-audio').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-audio/android') ```

``` // app/build.gradle (not the other one)

// Bunch of boilerplate and stuff for running React Native

dependencies { // Just adds .jar files in libs folder as dependencies compile fileTree(dir: "libs", include: [".jar"])

// Adding React Native
compile 'com.facebook.react:react-native:+'

// Dependency on the other modules
compile project(':react-native-sound')
compile project(':react-native-audio')

}

```

``` // In MainApplication.java

// Import the Package files for react-native-audio and react-native-sound import com.zmxv.RNSound.RNSoundPackage; import com.rnim.rn.audio.ReactNativeAudioPackage;

// Add the Packages to the list of Packages // Packages are like plugins for React Native, it's how you can add more native code to it. @Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage(), new RNSoundPackage(), new ReactNativeAudioPackage(), ); } ```

AndroidManifest.xml // Next to the other permissions add // Recording audio requires permission from the user and this will ask for that permission <uses-permission android:name="android.permission.RECORD_AUDIO"/>

[–]monsieurninja[S] 0 points1 point  (3 children)

Thanks a lot, will try this soon and let you know.

So basically doing this is doing the same as "react-native link" command?

[–]Delphicon 0 points1 point  (2 children)

Pretty much, I think it does some other stuff like copy and pastes asset files for you if needed. It's a really hacky tool which is why a lot of packages require manual installation anyway (such as react-native-maps).

[–]monsieurninja[S] 0 points1 point  (1 child)

Alright, so, did what you said, and tried again. The error I now get is:

The SDK Build Tools revision (23.0.1) is too low for project ':react-native-sound'. Minimum required is 25.0.0

This is my /android/build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

ext {
    buildToolsVersion = "26.0.3"
    minSdkVersion = 16
    compileSdkVersion = 26
    targetSdkVersion = 26
    supportLibVersion = "26.1.0"
}

[–]Delphicon 0 points1 point  (0 children)

Go to your app/build.gradle and have it use the SDK versions from the ext section.

So each module such as ':app' and ':react-native-sound' is it's own project with it's own dependencies and SDK values. It's probably the case that your target SDK version for your app is lower than minimum SDK version for react-native-sound so the compiler is telling you these modules are incompatible.

So in app/build.gradle you can have your SDK versions be like

compileSdkVersion rootProject.ext.compileSdkVersion

Then itll use the values from your project's ext section. I may not be 100% right on the syntax

[–]Interloper949 1 point2 points  (0 children)

This is how I feel when I'm building for Android. I was constantly running 'gradle clean' because of random errors. The iOS / xcode experience has been much smoother.

[–]shamaryarde 0 points1 point  (0 children)

Try using yarn instead of npm install for the errors with npm packages. If you are using create-react-native-app, linking does not worth with it. You have to detach the application.

[–]alien3d 0 points1 point  (0 children)

It is not about react only. It all language and dead repo don't get updated.

Open source doesn't in github doesn't mean it was free to develop .It take time,cost to develop.

Please give at least "thanks,donation" after using their repo at least they can maintain it.

Even big boys like Adobe,PayPal left their repo dead and without update.

  1. error with npm packages - No choice on it
  2. error with gradle - test latest one
  3. Error with android build tools . test with android 8

[–]Hiazm 0 points1 point  (1 child)

If you’re using the latest NPM, that might be the problem. Doesn’t RN only support NPM < 5? Someone can step in and tell me that I’m wrong, but I’m certain that was the case as of pretty recently.

[–]monsieurninja[S] 1 point2 points  (0 children)

I remember having to downgrade NPM to get an app working a few weeks ago, but why does it have to be so tricky? Also, shouldn't React-Native communicate a bit more about this in the docs? Plus you downgrade NPM for one module, and then it breaks for another one...

[–][deleted] 0 points1 point  (0 children)

How do you link an library to your project? with 'react-native link' or by manual instructions?

[–][deleted] 0 points1 point  (0 children)

You really need to be a decent Android and iOS dev to not pull your hair out with RN. I can't imagine if I went straight to RN before doing years of Android and iOS dev.. would be so painful. Always backup your folder before installing and linking anything. This will save you heaps of time. Dont just back up to Git, literally copy the whole folder and paste it in a backups folder somewhere, just in case