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

Opening Calendar on physical device #4

Open
eyalabadi98 opened this issue Oct 25, 2018 · 11 comments
Open

Opening Calendar on physical device #4

eyalabadi98 opened this issue Oct 25, 2018 · 11 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@eyalabadi98
Copy link
Contributor

Hello.

When I run the app with my physical device, the schedule doesnt respond.

More specifically, when I press the date button (to open the calendar view) it doesnt respond.

This doesnt happen on the simulator. I am suspecting an issue with how the Date is handeled in V8 vs chrome JS

@eyalabadi98
Copy link
Contributor Author

It was an issue with Date but on my part. I guess RN doesn’t like New Date when running without a chrome debugger

@wmlutz
Copy link
Owner

wmlutz commented Oct 25, 2018

Interesting. I tried to run all of the actual dates through MomentJS to deal with that sort of thing - for reasons I don't understand JS seems to just be a little janky when it comes to manipulating and working with dates. Let me know if you need anything else - or have suggestions.

@eyalabadi98
Copy link
Contributor Author

eyalabadi98 commented Oct 26, 2018

Actually this is still an ongoing issue.

My code:

          let teamHere = props.myschedule[i];
          console.log("TeamHere", teamHere)
          let dateStamp = teamHere['date'] + ' ' + teamHere['time'];
          let dateVa1 = moment(dateStamp).format('YYYY-MM-DD HH:mm:ss');
          let minutes = 45;
          let durationClonse = moment(dateStamp);
          let endTime = durationClonse.add(minutes, 'minutes').format('YYYY-MM-DD HH:mm:ss');
          // console.log("endTime", endTime);
          data.push({
                title: teamHere['team1']['category'] + ' ' +  teamHere['tournament']['sport'],
                subtitle: teamHere['team1']['country'] + ' ' + teamHere['team1']['number'] + ' vs. ' + teamHere['team2']['country'] + ' ' + teamHere['team2']['number'] + ' ' + teamHere['location'],
                // subtitle: teamHere['text'] + ' ' + teamHere['location'],
                start: dateVa1,
                end: endTime,
                // color: getRandomColor() + ''

            });

When I run this code with a debugger, it works fine. When I run it without, it loads very slowly

When I reduce the amount of loops from around 75 to 5-10, it works perfectly. If i remove your component from the return, the app works fine.

I am at a loss here.

@eyalabadi98 eyalabadi98 reopened this Oct 26, 2018
@wmlutz
Copy link
Owner

wmlutz commented Oct 26, 2018

@eyalabadi98 - OK got it. It sounds like a speed issue. I did use some hacky/brute force techniques when building so I could get it out faster.

First: disclaimer - I have done zero testing on the component. I hacked it together for my own project. That means that I have done no optimization for speed. In fact I'm pretty sure it's on the ReadMe as a 'to-do'.

Second: suggestion - if you need this working (or working faster at least) soonish I'd recommend doing a PR and diving in yourself. I built it and I'm the only maintainer/contributor at the moment and I my personal schedule won't let me do a ton of work on this for another week or so. Sorry about that.

@wmlutz wmlutz self-assigned this Oct 26, 2018
@wmlutz wmlutz added bug Something isn't working enhancement New feature or request labels Oct 26, 2018
@eyalabadi98
Copy link
Contributor Author

Were you able to reproduce this error? I want to make sure its the component, not my implementation

@wmlutz
Copy link
Owner

wmlutz commented Oct 26, 2018

Thanks for the PR/help!

@wmlutz wmlutz closed this as completed Oct 26, 2018
@eyalabadi98
Copy link
Contributor Author

This is actually still an issue.

The culprit here is moment-range. It makes it very slow to load items when running on the device.

Any ideas on how to go about?

@wmlutz
Copy link
Owner

wmlutz commented Oct 30, 2018

I use moment-range to manage appointment overlapping in the View (ProcRows - line 7). I'm pretty sure that's the only time I used it. The right answer is to make our own "overlap" function and then remove the moment-range library.

const overlap = (appt1, appt2) => {
  // Annoying if statement.
    return true

 return false
}

@wmlutz
Copy link
Owner

wmlutz commented Oct 30, 2018

Ok, slightly more complicated than that, but I can work on it tonight.

@wmlutz wmlutz reopened this Oct 30, 2018
@wmlutz
Copy link
Owner

wmlutz commented Nov 2, 2018

@eyalabadi98 - I refactored to remove moment-range as well as moment as many places as I could - reverting to JS' native date. Hopefully that improves the speed. Can you test it a bit and let me know?

@eyalabadi98
Copy link
Contributor Author

Hey Wmlutz! Thanks.

I think it did actually help it! Thanks for your help!

Ill be pushing also an update on the currenttime as your module displays the timenow incorrectly if the hoursize is different. You did hour * hour_size rather than divide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants